Skip to content

Commit 9f31b5f

Browse files
authored
Merge pull request #36 from reach2jeyan/35-plugin-crash-when-xdist-isnt-installed
Fixed reporter crash when xdist is not installed as plugin
2 parents 2022e0c + e68e56f commit 9f31b5f

4 files changed

Lines changed: 33 additions & 30 deletions

File tree

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ COPY . .
1818

1919
RUN ls -R /app
2020

21+
RUN poetry lock
22+
2123
RUN poetry install --with dev
2224

2325

README.md

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22

33
A powerful, plug-and-play Pytest plugin to generate **HTML + JSON reports**, detect **flaky tests**, and optionally **send reports via email**. Works beautifully with or without `xdist`.
44

5+
6+
7+
## 🚀 Installation
8+
9+
```bash
10+
pip install pytest-reporter-plus
11+
# or with Poetry
12+
poetry add --dev pytest-reporter-plus
13+
```
14+
15+
16+
## 🧾 Usage
17+
Generate HTML + JSON reports:
18+
19+
```bash
20+
pytest
21+
```
22+
If you are running with xdist
23+
24+
```commandline
25+
pytest -n numberOfWorkers
26+
```
27+
You’ll get:
28+
29+
report.html – a clean, styled HTML report
30+
531
---
632

733
## ✨ Features
@@ -56,34 +82,6 @@ With pytest-reporter-plus, you get a beautiful, lightweight HTML report out of t
5682

5783
Just install, run your tests, and let the plugin handle all the reporting magic. Focus on what matters: writing and running your tests.
5884

59-
60-
61-
## 🚀 Installation
62-
63-
```bash
64-
pip install pytest-reporter-plus
65-
# or with Poetry
66-
poetry add --dev pytest-reporter-plus
67-
```
68-
69-
70-
## 🧾 Usage
71-
Generate HTML + JSON reports:
72-
73-
```bash
74-
pytest
75-
```
76-
If you are running with xdist
77-
78-
```commandline
79-
pytest -n numberOfWorkers
80-
```
81-
You’ll get:
82-
83-
report.html – a clean, styled HTML report
84-
85-
playwright_report.json – structured data for integrations
86-
8785
## Available Options
8886
| Option | Description | Default | Choices |
8987
| ----------------------- | ------------------------------------------------------------------ | ------------------------ | ------------------------ |

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pytest-reporter-plus"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
description = "Lightweight enhanced HTML reporter for Pytest"
55
readme = "README.md"
66
authors = ["Emjey","Karan"]

pytest_reporter_plus/plugin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ def pytest_sessionfinish(session, exitstatus):
8989
screenshots = session.config.getoption("--screenshots") or "screenshots"
9090

9191
is_worker = os.getenv("PYTEST_XDIST_WORKER") is not None
92-
is_xdist = session.config.getoption("-n")
92+
try:
93+
is_xdist = bool(session.config.getoption("-n"))
94+
except ValueError:
95+
is_xdist = False
9396

9497
if is_worker:
9598
reporter.write_report()

0 commit comments

Comments
 (0)