testtrain-pytest-allure 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- testtrain_pytest_allure-0.1.0/.gitignore +6 -0
- testtrain_pytest_allure-0.1.0/PKG-INFO +61 -0
- testtrain_pytest_allure-0.1.0/README.md +49 -0
- testtrain_pytest_allure-0.1.0/pyproject.toml +35 -0
- testtrain_pytest_allure-0.1.0/src/testtrain_pytest_allure/__init__.py +5 -0
- testtrain_pytest_allure-0.1.0/src/testtrain_pytest_allure/plugin.py +590 -0
- testtrain_pytest_allure-0.1.0/tests/test_plugin.py +483 -0
- testtrain_pytest_allure-0.1.0/uv.lock +458 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: testtrain-pytest-allure
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pytest plugin that streams Allure test results to Testtrain in real time
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Requires-Dist: allure-pytest>=2.13
|
|
8
|
+
Requires-Dist: allure-python-commons>=2.13
|
|
9
|
+
Requires-Dist: pytest>=7.0
|
|
10
|
+
Requires-Dist: requests>=2.28
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# testtrain-pytest-allure
|
|
14
|
+
|
|
15
|
+
A pytest plugin that streams [Allure](https://allurereport.org/) test results to [Testtrain](https://github.com/njxqlus/testtrain) in real time using `allure-python-commons` hooks.
|
|
16
|
+
|
|
17
|
+
Each test result — including steps, parameters, attachments, and defect links — is posted to the Testtrain API immediately after the test finishes, with no file scanning required.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install testtrain-pytest-allure
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pytest \
|
|
29
|
+
--testtrain-url=http://localhost:3000 \
|
|
30
|
+
--testtrain-auth-token=your-token \
|
|
31
|
+
--alluredir=allure-results \
|
|
32
|
+
--testtrain-run-id=9f68e116-ca4a-470b-9fcf-72a9e39d126d
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The plugin activates automatically when all three `--testtrain-*` options are provided.
|
|
36
|
+
|
|
37
|
+
## Options
|
|
38
|
+
|
|
39
|
+
| Option | Description |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `--testtrain-url` | Testtrain platform base URL |
|
|
42
|
+
| `--testtrain-auth-token` | Bearer token for API authentication |
|
|
43
|
+
| `--testtrain-run-id` | UUID of an existing testrun to report results to |
|
|
44
|
+
|
|
45
|
+
## How It Works
|
|
46
|
+
|
|
47
|
+
The plugin registers a listener into `allure_commons.plugin_manager` that implements the `report_result` hook. When Allure finalises a test (after teardown), the listener:
|
|
48
|
+
|
|
49
|
+
1. Maps the `TestResult` object (status, steps, parameters, links) to the Testtrain API schema.
|
|
50
|
+
2. Collects any in-memory attachment data captured during the test run.
|
|
51
|
+
3. Sends everything to `POST /api/tests` (JSON or multipart when attachments are present).
|
|
52
|
+
4. Retries up to 3 times on transient errors with exponential back-off.
|
|
53
|
+
5. Stops the test session if all retries fail.
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cd plugins/testtrain-pytest-allure
|
|
59
|
+
uv sync
|
|
60
|
+
uv run pytest tests/
|
|
61
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# testtrain-pytest-allure
|
|
2
|
+
|
|
3
|
+
A pytest plugin that streams [Allure](https://allurereport.org/) test results to [Testtrain](https://github.com/njxqlus/testtrain) in real time using `allure-python-commons` hooks.
|
|
4
|
+
|
|
5
|
+
Each test result — including steps, parameters, attachments, and defect links — is posted to the Testtrain API immediately after the test finishes, with no file scanning required.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install testtrain-pytest-allure
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pytest \
|
|
17
|
+
--testtrain-url=http://localhost:3000 \
|
|
18
|
+
--testtrain-auth-token=your-token \
|
|
19
|
+
--alluredir=allure-results \
|
|
20
|
+
--testtrain-run-id=9f68e116-ca4a-470b-9fcf-72a9e39d126d
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The plugin activates automatically when all three `--testtrain-*` options are provided.
|
|
24
|
+
|
|
25
|
+
## Options
|
|
26
|
+
|
|
27
|
+
| Option | Description |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `--testtrain-url` | Testtrain platform base URL |
|
|
30
|
+
| `--testtrain-auth-token` | Bearer token for API authentication |
|
|
31
|
+
| `--testtrain-run-id` | UUID of an existing testrun to report results to |
|
|
32
|
+
|
|
33
|
+
## How It Works
|
|
34
|
+
|
|
35
|
+
The plugin registers a listener into `allure_commons.plugin_manager` that implements the `report_result` hook. When Allure finalises a test (after teardown), the listener:
|
|
36
|
+
|
|
37
|
+
1. Maps the `TestResult` object (status, steps, parameters, links) to the Testtrain API schema.
|
|
38
|
+
2. Collects any in-memory attachment data captured during the test run.
|
|
39
|
+
3. Sends everything to `POST /api/tests` (JSON or multipart when attachments are present).
|
|
40
|
+
4. Retries up to 3 times on transient errors with exponential back-off.
|
|
41
|
+
5. Stops the test session if all retries fail.
|
|
42
|
+
|
|
43
|
+
## Development
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cd plugins/testtrain-pytest-allure
|
|
47
|
+
uv sync
|
|
48
|
+
uv run pytest tests/
|
|
49
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "testtrain-pytest-allure"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Pytest plugin that streams Allure test results to Testtrain in real time"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
dependencies = [
|
|
13
|
+
"pytest>=7.0",
|
|
14
|
+
"allure-pytest>=2.13",
|
|
15
|
+
"allure-python-commons>=2.13",
|
|
16
|
+
"requests>=2.28",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.entry-points."pytest11"]
|
|
20
|
+
testtrain-allure = "testtrain_pytest_allure.plugin"
|
|
21
|
+
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["src/testtrain_pytest_allure"]
|
|
24
|
+
|
|
25
|
+
[dependency-groups]
|
|
26
|
+
dev = [
|
|
27
|
+
"ruff",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[tool.ruff]
|
|
31
|
+
line-length = 100
|
|
32
|
+
target-version = "py39"
|
|
33
|
+
|
|
34
|
+
[tool.ruff.lint]
|
|
35
|
+
select = ["E", "F", "I", "UP"]
|