pytest-scenario-files

Making Pytest Scenarios Easy and Scalable

Compatible Python versions badge Pytest Plug-in badge

Hatch badge Ruff badge Pre-commit badge

pytest-scenario-files is a pytest plugin that runs unit test scenarios using data loaded from files.

Features

  • Loads data for scenarios from files into fixtures

  • Data files are matched with tests by a naming convention

  • Multiple scenario data sets may be in one file

  • There may be multiple data files for each test

  • Fixtures may refer to fixtures in other files

  • Can specify indirect parameterization

  • Intuitive and sane data file structure

  • Integration with Responses mocking package for Requests

  • NEW - Integration with the Respx mocking package for Httpx

Compatibility

This package is a plug-in for Pytest and works with Python 3.9 and up.

  • Tested with Pytest versions 7.4, 8.2 and 8.3

  • Tested with CPython 3.9–3.13

  • Tested with Responses 0.25.7

  • Tested with Respx 0.22.0