Skip to main content

A Python package for managing pytest plugins.

Project description

PyPI version Python Development Status Maintenance PyPI License


pytest-plugins

An advanced pytest plugin designed for Python projects, offering robust features and utilities to enhance the testing workflow.
It includes improved conftest.py fixtures, automated test result reporting, detailed logging, and seamless integration with external tools for a streamlined and efficient testing experience.


🚀 Features

  • better-report: Enhanced test result tracking and structured JSON reporting. generate execution_results.json, test_results.json, and test_report.md under tests/results_output/ directory.
    • flags:
      • --better-report: Enable the better report feature.
      • --output-dir: Specify the output directory for the report files (default is root_project/results_output/).
      • --traceback: Include detailed traceback information in the report.
      • --md-report: Generate a Markdown report of the test results.
      • repo-name: Specify the git repository name for the report.
      • --pr-number: Include a pull request number in the report for better traceability.
      • --mr-number: Include a merge request number in the report for better traceability.
      • --pipeline-number: Include a CI pipeline number in the report for better traceability.
      • --commit: Include the commit hash in the report for better traceability.
      • --add-parameters: Add the test parameters as fields to the test results.
      • --pytest-command: Add the detailed information about the pytest command-line to the "execution_results.json" file
      • --pytest-xfail-strict: Enable strict xfail handling, treating unexpected passes as failures, if set to True "execution status" will be "failed" when there is at least one xpass test
      • --result-each-test: Print the pytest result for each test after its execution
      • --log-collected-tests: Log all collected tests at the start of the test session

  • maxfail-streak: Stop test execution after a configurable number of consecutive failures.
    • flags:
      • --maxfail-streak=N: Stop test execution after N consecutive failures.

  • fail2skip: Change failing tests to skipped, allowing for better test management and reporting.
  • flags:
    • --fail2skip: Enable the fail2skip feature.
      • @pytest.mark.fail2skip: Decorator to mark tests that should be skipped on failure.

  • verbose-param-ids: Enhance test IDs with parameter names for better clarity in pytest reports.
  • flags:
    • --verbose-param-ids: Include parameter names in pytest test IDs (e.g., (param1: value1, param2: value2) instead of (param1-param2))

  • require-tests: Fail the run if no tests were collected. Raises a UsageError (exit code 4) when --require-tests is set and zero tests are found.
    • flags:
      • --require-tests: Enable the require-tests feature.

📦 Installation

pip install pytest-plugins

🔧 Usage

Add the following to your pytest.ini file to enable the plugin features:
[pytest]
addopts =
    --better-report
    --output-dir=logs
    --pr-number=123
;    --mr-number=123
    --fail2skip
    --maxfail-streak=3
    --add-parameters
    --pytest-command
    --verbose-param-ids
    --md-report
    --traceback
    --require-tests

🤝 Contributing

If you have a helpful tool, pattern, or improvement to suggest: Fork the repo
Create a new branch
Submit a pull request
I welcome additions that promote clean, productive, and maintainable development.


🙏 Thanks

Thanks for exploring this repository!
Happy coding!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_plugins-3.1.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_plugins-3.1.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_plugins-3.1.0.tar.gz.

File metadata

  • Download URL: pytest_plugins-3.1.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytest_plugins-3.1.0.tar.gz
Algorithm Hash digest
SHA256 1d8322708a22c2f90d5f9029c4049e3bfb3cdbc8cb3a60832ae41c3a719af0bf
MD5 f6fd20bb627ddd539e7337b2b128c295
BLAKE2b-256 89e7ae7b3e3cd185e043d66c700d5c60b6f238762e6ca57f4f1379b2410b7f95

See more details on using hashes here.

File details

Details for the file pytest_plugins-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_plugins-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytest_plugins-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc3b98a9d16c35708b70b3d57f5fc911f5ccd9263557635f6e7705151bb864df
MD5 6d2e1d31e7cbd93492a4a0c8fe3b4aff
BLAKE2b-256 26fb60d4377feddb9ab53d0d6180d9a6374559e35dd9a487f7950962b97065a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page