Extensions for allure-pytest: propagate step failures and aggregate step failures
Project description
allure-pytest-ext
Extensions for allure-pytest focused on test ergonomics and clear reporting.
This plugin adds two capabilities on top of Allure's standard API:
with allure.step(title, propagate=True, ...): make steps fail even if exceptions inside are caught by user code; optionally re-raise on the parent after the step finishes.with allure.aggregate_step(title): run all child steps and aggregate failures into a single error raised at the end.
Links
- Live Allure demo report (GitHub Pages): pytest-allure-propagate report
- The demo report is generated automatically on tag creation (release workflow), and can also be built manually via the "Allure Pages" workflow.
- Official Allure docs:
https://allurereport.org - Allure pytest page on PyPI:
https://pypi.org/project/allure-pytest/
Installation
Official (uv)
uv add allure-pytest-ext
Alternative (pip)
pip install allure-pytest-ext
Compatibility
- Python: 3.8 – 3.13
- Allure pytest adapter: designed for
allure-pytestversions 2.13.3–2.13.4. At runtime, the plugin emits a warning if the installedallure-pytestversion is outside this range.
Quick start
- Write tests using the plugin’s features where they add value in your flow.
import pytest
import allure
def test_propagate_caught_error() -> None:
# Your code catches the error locally, but you still want the step to fail
# and the error to surface at the test level.
with allure.step('parnet-step')
try:
with allure.step("child-step", propagate=True):
raise ValueError("missing required field: id")
except Exception:
...
# Not only the child-step will apper red,
# also the parnet-step will apper yellow, but It won't raise an expecptiom
def test_aggregate_sibling_failures() -> None:
# Run independent checks and see all failures together rather than failing fast.
with allure.aggregate_step("check downstream services"):
with allure.step("service A health"):
raise RuntimeError("timeout")
with allure.step("service B schema"):
... # this step will run
# now the step `check downstream services` will rise the expection
- Run tests and generate Allure results folder.
uv run pytest --alluredir=.allure-results --ignore=tests/test_mock.py
# or
pytest --alluredir=.allure-results --ignore=tests/test_mock.py
- Serve the report locally.
allure serve .allure-results
- Optional: log step start/end in test logs
Enable source logger messages for step START/END via any of the following:
pytest --alluredir=.allure-results --ignore=tests/test_mock.py --allure-log-steps
# pytest.ini
allure_log_steps = true
ALLURE_EXT_LOG_STEPS=1 pytest --alluredir=.allure-results --ignore=tests/test_mock.py
API additions
-
allure.step(title: str, propagate: bool = False, raise_on_parent: bool = False)propagate=True: if any exception occurs inside the step and is caught by test code, the step is still marked failed.raise_on_parent=True: when used together withpropagate=True, re-raise the first observed exception after the step exits (affects the parent scope).
-
allure.aggregate_step(title: str)- Executes all nested steps even if some fail. At the end, raises an aggregated error comprising all child failures.
- The aggregated error type is
allure_pytest_ext.plugin.AggregateError.
Configuration
-
Source logger step events (START/END) can be enabled via any of:
- CLI:
--allure-log-steps - pytest.ini:
allure_log_steps = true - Env:
ALLURE_EXT_LOG_STEPS=1(orALLURE_LOG_STEPS=1)
- CLI:
-
Debug tracing (prints when exceptions are seen inside steps):
- Env:
ALLURE_EXT_DEBUG_TRACE=1
- Env:
Development
# Setup dev environment
uv sync --all-extras --dev
# Lint, type-check, test
uv run black --check src tests
uv run flake8 src tests
uv run mypy --strict src tests
uv run pytest -q --ignore=tests/test_mock.py
License
MIT
Project details
Release history Release notifications | RSS feed
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_ext-2.13.5.tar.gz.
File metadata
- Download URL: allure_pytest_ext-2.13.5.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
806b7b0ffd6958ffa3e71d8d5caecd6e8e7c2448c6562b743468bfd6026858dc
|
|
| MD5 |
93e356cb5780ac40ac3e6ca32665fbbc
|
|
| BLAKE2b-256 |
62a51a879b2075f53ae36f6c73d39be4202dd7cde588dbd8df1b97aef71c29a8
|
Provenance
The following attestation bundles were made for allure_pytest_ext-2.13.5.tar.gz:
Publisher:
release-on-tag.yml on ramihsn/pytest-allure-propagate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
allure_pytest_ext-2.13.5.tar.gz -
Subject digest:
806b7b0ffd6958ffa3e71d8d5caecd6e8e7c2448c6562b743468bfd6026858dc - Sigstore transparency entry: 428343541
- Sigstore integration time:
-
Permalink:
ramihsn/pytest-allure-propagate@900dc4e30e69a83aa39812002fd2f90fd49eba5c -
Branch / Tag:
refs/tags/2.13.5 - Owner: https://github.com/ramihsn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-on-tag.yml@900dc4e30e69a83aa39812002fd2f90fd49eba5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file allure_pytest_ext-2.13.5-py3-none-any.whl.
File metadata
- Download URL: allure_pytest_ext-2.13.5-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b8ab4b62313aae0d6bdb1b7caf97863dc7c1ac262f88c14074ba06b0c21fbc3
|
|
| MD5 |
5995c2d4bb22a7d28ecaf68101d8265f
|
|
| BLAKE2b-256 |
0be74c2cf993b6f48433cd9c85bcb1d0f671945a8a3fec5cb65251a3e2897138
|
Provenance
The following attestation bundles were made for allure_pytest_ext-2.13.5-py3-none-any.whl:
Publisher:
release-on-tag.yml on ramihsn/pytest-allure-propagate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
allure_pytest_ext-2.13.5-py3-none-any.whl -
Subject digest:
9b8ab4b62313aae0d6bdb1b7caf97863dc7c1ac262f88c14074ba06b0c21fbc3 - Sigstore transparency entry: 428343543
- Sigstore integration time:
-
Permalink:
ramihsn/pytest-allure-propagate@900dc4e30e69a83aa39812002fd2f90fd49eba5c -
Branch / Tag:
refs/tags/2.13.5 - Owner: https://github.com/ramihsn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-on-tag.yml@900dc4e30e69a83aa39812002fd2f90fd49eba5c -
Trigger Event:
push
-
Statement type: