pytest-custom-exit-code is a pytest plugin that allows users to customize the exit code of a pytest test session in specific scenarios. Currently at version 0.3.0, its primary function is to alter the default exit codes, such as when no tests are collected or when tests fail. The library has had a slow release cadence, with the last update in August 2019.
pip install pytest-custom-exit-codeNo compatibility data collected yet for this library.
The plugin is typically used by passing command-line options to `pytest` or by configuring them in a `pytest.ini` file. There are no direct Python imports from the plugin itself for its core functionality. The primary options are `--suppress-no-test-exit-code` to change exit code 5 (no tests collected) to 0, and `--suppress-tests-failed-exit-code` to change exit code 1 (tests failed) to 0.
Consider updating to a newer, actively maintained pytest plugin if one exists for custom exit code logic, or carefully test this plugin with your specific Python and pytest versions. If compatibility issues arise, manual patching or refactoring might be necessary.
Always use the provided command-line flags or `pytest.ini` configuration to leverage this plugin's features. Do not attempt to import symbols from `pytest_custom_exit_code`.
Be explicit about the expected exit codes in your CI/CD pipelines. If using `--suppress-tests-failed-exit-code`, ensure that test failure reports are still thoroughly checked. If using `--suppress-no-test-exit-code`, verify that tests are indeed being collected and run, especially in environments where test discovery might be flaky.