Registry / testing / allure-pytest

allure-pytest

JSON →
library2.16.0pypypi✓ verified 25d ago

Allure pytest integration provides a way to integrate the Allure Test Reporting Framework with pytest tests. It functions as a pytest plugin, automatically collecting test results and generating comprehensive, interactive reports. The library is actively maintained as part of the `allure-python` monorepo, with frequent minor releases, typically on a monthly or bi-monthly basis.

pip install allure-pytest
INSTALL
IMPORT
SIG · ALLURE-PYTEST
A
allure-pytest
testingpythonv2.16.0
Install
2.9s avg
Import
85ms
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.16.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.086s · 31.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.9s · import 0.084s · 32MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

allure
import allure
Primary import for Allure decorators and dynamic API functions.
LabelType
from allure_commons.types import LabelType
Used for defining standard Allure labels programmatically.

This quickstart demonstrates a basic pytest test file with Allure decorators. To generate the Allure report, first run pytest with the `--alluredir` option to create XML results. Then, use the `allure serve` command (from the separately installed Allure command-line tool) to process these XML files and open an interactive HTML report in your browser. The Allure command-line tool requires Java.

# test_example.py import allure import pytest @allure.epic("Web Testing") @allure.feature("Login Functionality") def test_successful_login(): allure.dynamic.story("User can log in with valid credentials") with allure.step("Enter username and password"): print("Entering credentials...") with allure.step("Click login button"): print("Clicking login...") assert True @allure.epic("API Testing") @allure.feature("User Management") def test_get_user_profile(): allure.dynamic.story("Retrieve user data via API") with allure.step("Send GET request to user endpoint"): print("Sending request...") with allure.step("Verify response status code"): print("Checking status...") with allure.step("Validate user data in response"): print("Validating data...") assert True # To run tests and generate Allure results: # pytest --alluredir=allure-results # To serve the Allure report (requires Allure command-line tool): # allure serve allure-results
Debug
Known issues
breakingOlder versions of `allure-pytest` (pre-2.14.3) may not correctly handle `allure.title` for fixtures when used with `pytest` version 8.4 or later.
fix
Upgrade to `allure-pytest` version 2.14.3 or higher to ensure fixture titles are correctly displayed in reports.
affects: <2.14.3
gotchaIf you were previously using `pytest-allure-adaptor`, it must be uninstalled before installing `allure-pytest` due to conflicting implementations. The `allure-pytest` setup process will explicitly check for this conflict.
fix
Run `pip uninstall pytest-allure-adaptor` before `pip install allure-pytest`.
affects: All versions
breakingAs of `allure-python` 2.14.0, official support for Python 3.7 has been dropped. Users on Python 3.7 will not receive updates or fixes for newer `allure-pytest` versions.
fix
Upgrade your Python environment to 3.8 or newer.
affects: >=2.14.0
gotchaThe Allure Report command-line tool (required to generate and serve HTML reports) is a separate installation from `allure-pytest` and requires a Java Runtime Environment (JRE) to function.
fix
Download and install the Allure command-line tool (e.g., via Homebrew on macOS, or manually) and ensure Java is installed and accessible in your PATH.
affects: All versions
gotchaIn versions prior to 2.15.0, reports for tests defined within nested classes might have incorrect `fullName`, `historyId`, `testCaseId`, and `subSuite` values, leading to improper grouping and history tracking.
fix
Upgrade to `allure-pytest` version 2.15.0 or higher for accurate reporting of nested test classes.
affects: <2.15.0
gotchaAs of version 2.14.3, built-in (reserved) `pytest` markers are no longer converted into Allure tags. If your reporting workflow relied on these markers appearing as tags, this behavior has changed.
fix
Use explicit `allure.tag()` or `@allure.tag()` decorators for custom tags, or consider custom hooks if specific `pytest` markers still need to be mapped to Allure tags.
affects: >=2.14.3
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'allure.constants'
The 'allure.constants' module has been deprecated and removed in newer versions of allure-pytest.
fix
Replace 'from allure.constants import AttachmentType' with 'from allure import attachment_type'.
AttributeError: module 'allure' has no attribute 'severity_level'
The 'severity_level' attribute has been removed or renamed in recent versions of allure-pytest.
fix
Use 'from allure import severity_level' instead of 'allure.severity_level'.
ModuleNotFoundError: No module named 'allure_commons'
The 'allure_commons' module is not installed or not found in the Python environment.
fix
Install the module using 'pip install allure-python-commons'.
AttributeError: 'str' object has no attribute 'iter_parents'
Incompatibility between allure-pytest and pytest versions due to changes in pytest's internal APIs.
fix
Downgrade pytest to a compatible version, such as 'pytest==8.0.0'.
SyntaxError: invalid syntax
Attempting to run allure-pytest with an unsupported Python version, such as Python 2.7.
fix
Upgrade to Python 3.6 or higher to use allure-pytest.
Upgrade
Version history
2.16.0latest on PyPI · released Apr 27, 2026
Audit
Dependencies
pytestrequiredRequired for test execution framework.
allure-python-commonsrequiredCommon engine for all Allure Python integrations.
allure-commandlinerequiredExternal tool required to generate and serve HTML reports. Requires Java Runtime Environment.
Agent activity
98 hits · last 30 days
node
94
OpenAI (training)
1
Resources
allure-pytest — pip install allure-pytest · libregistry