Generate default "unknown" results to show in Allure Report if test case does not run
Project description
allure-pytest only reports tests that were attempted
If a test case does not run (because the runner set up failed or because a CI job timed out on a previous test), the test case will be omitted from Allure Report.
This plugin creates default "unknown" status results for each test case that's expected to run. After the tests run, the default result can be included for any test case that does not have an actual test result—so that those test cases show up as "unknown" in the Allure Report.
For example, to merge the actual test results with the default "unknown" results:
import dataclasses
import json
import pathlib
@dataclasses.dataclass(frozen=True)
class Result:
test_case_id: str
path: pathlib.Path
def __eq__(self, other):
if not isinstance(other, type(self)):
return False
return self.test_case_id == other.test_case_id
actual_results = pathlib.Path("allure-results")
default_results = pathlib.Path("allure-default-results")
results: dict[pathlib.Path, set[Result]] = {
actual_results: set(),
default_results: set(),
}
for directory, results_ in results.items():
for path in directory.glob("*-result.json"):
with path.open("r") as file:
id_ = json.load(file)["testCaseId"]
results_.add(Result(id_, path))
actual_results.mkdir(exist_ok=True)
missing_results = results[default_results] - results[actual_results]
for default_result in missing_results:
# Move to `actual_results` directory
default_result.path.rename(actual_results / default_result.path.name)
As of 2025-01-31, the "unknown" status is not used by the allure-pytest adapter.
Upstream feature request to replace this plugin: https://github.com/allure-framework/allure-python/issues/821
Usage
Generate default results
pytest --allure-default-dir=allure-default-results
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file allure_pytest_default_results-0.1.4.tar.gz.
File metadata
- Download URL: allure_pytest_default_results-0.1.4.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eeaacf7836105724df549042e13b740b91013b2a53258ac456ea5fd82f3faa0
|
|
| MD5 |
f879cbb632b0bf7bbede6a51fda2aa7a
|
|
| BLAKE2b-256 |
d0867efea63ea5a162329288cbe76c4618d35b3a6e3dc1877822f78e44da0f5a
|
Provenance
The following attestation bundles were made for allure_pytest_default_results-0.1.4.tar.gz:
Publisher:
release.yaml on canonical/allure-pytest-default-results
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
allure_pytest_default_results-0.1.4.tar.gz -
Subject digest:
2eeaacf7836105724df549042e13b740b91013b2a53258ac456ea5fd82f3faa0 - Sigstore transparency entry: 1243514470
- Sigstore integration time:
-
Permalink:
canonical/allure-pytest-default-results@561662e4549bf4a2957e28c0ee380ce49a9d5677 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/canonical
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@561662e4549bf4a2957e28c0ee380ce49a9d5677 -
Trigger Event:
push
-
Statement type:
File details
Details for the file allure_pytest_default_results-0.1.4-py3-none-any.whl.
File metadata
- Download URL: allure_pytest_default_results-0.1.4-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9cfc442e6108552c2cc0c3d818f61f8d718bca219ec60041273aa4ae57f0c04
|
|
| MD5 |
c99f5b38b293f4bc12c80725de7eb798
|
|
| BLAKE2b-256 |
bdfb71234d046b1efebc40f103431ffddda0f8e8ea01adcd2219fc4f7c0b8130
|
Provenance
The following attestation bundles were made for allure_pytest_default_results-0.1.4-py3-none-any.whl:
Publisher:
release.yaml on canonical/allure-pytest-default-results
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
allure_pytest_default_results-0.1.4-py3-none-any.whl -
Subject digest:
b9cfc442e6108552c2cc0c3d818f61f8d718bca219ec60041273aa4ae57f0c04 - Sigstore transparency entry: 1243514471
- Sigstore integration time:
-
Permalink:
canonical/allure-pytest-default-results@561662e4549bf4a2957e28c0ee380ce49a9d5677 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/canonical
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@561662e4549bf4a2957e28c0ee380ce49a9d5677 -
Trigger Event:
push
-
Statement type: