PyTest + Allure
Introduction
In this article you can get acquainted with various examples of creating reports for PyTest tests
using
Allure
.
An Allure report is a set of
JSON
files created by the allure-pytest library.
These reports are viewed in a browser with the help of the Allure web server, which is written in
Java
.
That is, Java does not have to be installed on the host where the tests are run.
The reports can be opened on another host where
Allure
is installed.
Installation
I recommend creating and activating a virtual environment , for example with venv .
python -m venv venv
.\venv\Scripts\activate
Or, if you are on Linux
source .venv/bin/activate
The installation command
python -m pip install allure-pytest
Compatibility
At the moment (April 2026) the latest versions of pytest (8+) and allure-pytest (2.13.2) are still incompatible.
The most recent combination that works together is:
allure-pytest==2.13.2 pytest==7.4.4
Create a report
Once allure-pytest is installed, you can run the tests with PyTest, specifying the directory in which the reports should be saved.
python -m pytest pytest\demo.py --alluredir allure-results
The directory for saving the reports can be set in pytest.ini
[pytest] addopts = --alluredir=Z:\allure-results
Article author: Arthur Isaev