Skip to main content

pytest-ignore-test-results

A pytest plugin that enables selective test result ignoring while maintaining test execution.

Installation

pip install -U pytest-ignore-test-results

Features

  • Ignore specific test case results using exact names or patterns
  • Load ignore patterns from files
  • Custom exit codes for different failure scenarios
  • Support for child test cases
  • Mark ignored JUnit failures and errors with is_ignored="1"
  • Option to ignore "no tests collected" errors

Usage

Ignore Test Results by Case Name or Pattern

When using this plugin, test cases will execute normally but their results can be selectively ignored. You have two options for specifying which test results to ignore:

  1. Using exact names or patterns directly:
pytest --ignore-result-cases "test_feature_1" "test_feature_2"
pytest --ignore-result-cases "test_feature_*" "test_integration_*"
  1. Specifying patterns in files:
pytest --ignore-result-files ignore_list.txt another_list.txt

Example ignore file content (ignore_list.txt):

test_feature_1  # This is a comment
test_feature_*
test_integration_suite::test_case_1

Child Test Cases

Failed child cases can be ignored by their names with --ignore-result-cases or --ignore-result-files. When pytest-embedded provides Unity cases, their names are used for matching; ignoring the parent test also ignores its failed children. If both the legacy child-case stash and Unity cases exist for one test, the legacy cases take precedence. pytest-embedded is optional.

Control Exit Codes

The plugin provides fine-grained control over exit codes through two options:

  1. --strict-exit-code: When enabled, the plugin will return exit code 6 if all failed test cases are ignored. Otherwise, it maintains pytest's original exit code behavior.
pytest --ignore-result-cases "test_feature_*" --strict-exit-code
  1. --ignore-no-tests-collected: When enabled, this option suppresses "no tests collected" errors and returns exit code 0.
pytest --ignore-no-tests-collected

Custom Test Case Names

The plugin supports test case name customization through the pytest_custom_test_case_name hook:

def pytest_custom_test_case_name(item):
    """
    Args:
        item: pytest item

    Returns:
        str: Custom name for the test case
    """
    return f"custom_name::{item.name}"

Metadata

Release files for pytest-ignore-test-results 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-ignore-test-results 0.5.0
File Size Uploaded Provenance Actions
pytest_ignore_test_results-0.5.0.tar.gz 9.9 kB Without provenance Details for pytest_ignore_test_results-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-ignore-test-results 0.5.0
File Interpreter ABI Platform Actions
pytest_ignore_test_results-0.5.0-py3-none-any.whl Python 3 none any Details for pytest_ignore_test_results-0.5.0-py3-none-any.whl

Total release size: 21.8 kB

Release files / pytest_ignore_test_results-0.5.0.tar.gz

Download URL pytest_ignore_test_results-0.5.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e1512a558cfdd6a85927a5c37771e86bb207d68d715ce40062ae01622839ec5b
BLAKE2b-256 checksum
How to use checksums
ad9cc40c3a4c930a174882be6789d7059e5d33fdff549a5d9163ea0b43735187
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pytest_ignore_test_results-0.5.0-py3-none-any.whl

Download URL pytest_ignore_test_results-0.5.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91b89a4ef528754faca83ea1e4f19e1b67562d348d1822c620af9dcab75ca14c
BLAKE2b-256 checksum
How to use checksums
0126a5060488c10f18f049dd0078950ede8172d7771b732c0ba85ef185dc494b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pytest-ignore-test-results 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page