allure-pytest
A pytest plugin that generates rich, interactive Allure test reports with steps and attachments
Repository Health
Technical Analysis
allure-pytest is the official pytest integration for the Allure Report framework. Installed as a pytest plugin, it hooks into test collection and execution to capture step-by-step results, attachments (screenshots, logs, HTML), severities, links, and fixtures, then writes them to an allure-results directory that the standalone Allure command-line tool renders into an interactive HTML report.
It is one of several language/framework integrations under the allure-python monorepo (which also includes behave, nose2, robotframework, and pytest-bdd plugins), all built on the shared allure-python-commons library that defines Allure’s result model and reporting primitives.
What You Get
- Automatic capture of test outcomes, durations, and tracebacks in Allure’s structured result format
- Decorators and context managers for custom steps, severities, links, and test descriptions
- Attachment support for screenshots, logs, HTML snapshots, and arbitrary files tied to a test step
- Fixture and parametrization tracking so parametrized test runs show individually in the report
- Shared result-model primitives via
allure-python-commons, keeping output compatible across allure-behave, allure-robotframework, and other integrations
Common Use Cases
- Generating interactive HTML test reports for CI pipelines (Jenkins, GitHub Actions, GitLab CI) with the Allure report server or CLI
- Attaching screenshots and browser logs to failed Selenium/Playwright test steps for debugging
- Tracking test history and flaky-test trends across CI runs using Allure’s trend graphs
- Categorizing and prioritizing test failures by severity for QA triage workflows
Under The Hood
Architecture: allure-pytest is one package inside the allure-python monorepo, which hosts allure-pytest, allure-behave, allure-nose2, allure-robotframework, allure-pytest-bdd, and the shared allure-python-commons/allure-python-commons-test libraries; the pytest plugin itself (src/plugin.py, src/listener.py) registers pytest hooks that translate test events into calls against the commons result model, with src/stash.py tracking per-test state and src/helper.py exposing the public allure.step/allure.attach API. Tech Stack: Pure Python, packaged with setuptools, depends on allure-python-commons for the shared reporting model and integrates with pytest’s plugin/hook system (pytest11 entry point). Code Quality: The monorepo’s tests/ trees contain roughly 240 test files exercising each framework integration against example suites, run via tox/pytest in CI across multiple Python and pytest versions. API Design: The public surface is a small set of decorators and context managers (@allure.step, allure.attach, @allure.severity) that require no configuration beyond installing the plugin and pointing pytest at an --alluredir, making adoption low-friction for existing pytest suites.