Skip to main content

A pytest plugin to ignore test results.

Project description

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
  • 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

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}"

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_ignore_test_results-0.3.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

pytest_ignore_test_results-0.3.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest_ignore_test_results-0.3.0.tar.gz.

File metadata

File hashes

Hashes for pytest_ignore_test_results-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0577e2cb35a304bc437044b7367f264faa6a666d99e180590c73c32286e6deaf
MD5 7ca1e74e3aa44ec301234306812e7fe9
BLAKE2b-256 9b1277a2d780c7b1b2150790d7545a7104b3bdfe6dcab630ae4e28312bfed018

See more details on using hashes here.

File details

Details for the file pytest_ignore_test_results-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_ignore_test_results-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8300bc2ff0a4020a88732d34689331b214b3b9b7dbfc436edc3c08ad47cb400
MD5 7352db6fb1a9b9051caa8a827ede0d07
BLAKE2b-256 58f76e1937e5fa830e53e3a378b52e7ada4e3b6c28cf7b8564ec3d8b8dc78e01

See more details on using hashes here.

Supported by

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