{"id":1318,"library":"allure-pytest","title":"Allure pytest integration","description":"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.","status":"active","version":"2.15.3","language":"en","source_language":"en","source_url":"https://github.com/allure-framework/allure-python","tags":["testing","reporting","pytest","allure","qa"],"install":[{"cmd":"pip install allure-pytest","lang":"bash","label":"Install allure-pytest"}],"dependencies":[{"reason":"Required for test execution framework.","package":"pytest","optional":false},{"reason":"Common engine for all Allure Python integrations.","package":"allure-python-commons","optional":false},{"reason":"External tool required to generate and serve HTML reports. Requires Java Runtime Environment.","package":"allure-commandline","optional":false}],"imports":[{"note":"Primary import for Allure decorators and dynamic API functions.","symbol":"allure","correct":"import allure"},{"note":"Used for defining standard Allure labels programmatically.","symbol":"LabelType","correct":"from allure_commons.types import LabelType"}],"quickstart":{"code":"# test_example.py\nimport allure\nimport pytest\n\n@allure.epic(\"Web Testing\")\n@allure.feature(\"Login Functionality\")\ndef test_successful_login():\n    allure.dynamic.story(\"User can log in with valid credentials\")\n    with allure.step(\"Enter username and password\"):\n        print(\"Entering credentials...\")\n    with allure.step(\"Click login button\"):\n        print(\"Clicking login...\")\n    assert True\n\n@allure.epic(\"API Testing\")\n@allure.feature(\"User Management\")\ndef test_get_user_profile():\n    allure.dynamic.story(\"Retrieve user data via API\")\n    with allure.step(\"Send GET request to user endpoint\"):\n        print(\"Sending request...\")\n    with allure.step(\"Verify response status code\"):\n        print(\"Checking status...\")\n    with allure.step(\"Validate user data in response\"):\n        print(\"Validating data...\")\n    assert True\n\n# To run tests and generate Allure results:\n# pytest --alluredir=allure-results\n\n# To serve the Allure report (requires Allure command-line tool):\n# allure serve allure-results","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade to `allure-pytest` version 2.14.3 or higher to ensure fixture titles are correctly displayed in reports.","message":"Older 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.","severity":"breaking","affected_versions":"<2.14.3"},{"fix":"Run `pip uninstall pytest-allure-adaptor` before `pip install allure-pytest`.","message":"If 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade your Python environment to 3.8 or newer.","message":"As 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.","severity":"breaking","affected_versions":">=2.14.0"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to `allure-pytest` version 2.15.0 or higher for accurate reporting of nested test classes.","message":"In 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.","severity":"gotcha","affected_versions":"<2.15.0"},{"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.","message":"As 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.","severity":"gotcha","affected_versions":">=2.14.3"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}