A pytest plugin to ignore test results.
Maintained. Last release 4 days ago, commits in 4 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install pytest-ignore-test-resultspytest-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:
- Using exact names or patterns directly:
pytest --ignore-result-cases "test_feature_1" "test_feature_2"
pytest --ignore-result-cases "test_feature_*" "test_integration_*"
- 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:
--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
--ignore-no-tests-collected: When enabled, this option suppresses "no tests collected" errors and returns exit code 0.
pytest --ignore-no-tests-collected