pytest-custom-exit-code
Exit pytest test session with custom exit code in different scenarios
What it is and what it does
pytest-custom-exit-code is a pytest plugin that overrides the default exit codes pytest returns at the end of a test session. Normally, pytest exits with specific codes to signal test outcomes (e.g., 1 for failures, 5 for no tests collected). This plugin adds command-line flags to suppress or customize those exit codes in specific scenarios—for instance, to exit with 0 even when tests fail or when no tests are found, which can be useful in CI/CD pipelines where you want to handle test outcomes differently.
The plugin depends only on pytest and installs as a wheel with no compiled dependencies. It is straightforward to use via command-line flags passed to pytest. However, the project has been abandoned since 2020, with no updates to support newer pytest or Python versions, so compatibility with current environments is uncertain.
Use it for:
- Suppress the exit code when pytest finds no tests, allowing CI pipelines to continue without treating it as a failure.
- Suppress the exit code when tests fail, so your build system can decide how to handle test failures independently.
- Integrate pytest into legacy CI/CD systems that expect different exit codes than pytest's defaults.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that lets you customize the exit code pytest returns when tests fail or when no tests are found, instead of using pytest's default exit codes.
No. The package is abandoned (last update 2020) and compatibility with modern pytest and Python versions is unverified. If you need custom exit code handling, consider whether pytest's native exit codes meet your needs or explore actively maintained alternatives before relying on this plugin.
Install
pytest-custom-exit-code on PyPI
pip
pip install pytest-custom-exit-codeuv
uv add pytest-custom-exit-codepoetry
poetry add pytest-custom-exit-codeInstalling pytest-custom-exit-code
Before you install
Low friction to install, but the package is abandoned—last release was in 2019 and last commit in 2020. No recent maintenance or updates.
License in practice
MIT license is permissive; you can use this freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pytest-custom-exit-code
pytest --suppress-no-test-exit-code
pytest --suppress-tests-failed-exit-code
Verify before relying
- Whether the plugin works with modern pytest versions released after 2020.
- Whether the two command-line options (suppress-no-test-exit-code, suppress-tests-failed-exit-code) are the only available customizations or if there are others.
- Whether there are any known incompatibilities with current Python or pytest releases.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | abandoned — 2,564 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,855,803/month — #1,688 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_custom_exit_code-0.3.0-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-error-for-skipsA pytest plugin that converts skipped tests…
permissive · top 15,000 on PyPI
pytest-loggingA pytest plugin that configures Python logging…
permissive · top 15,000 on PyPI
pytest-pickedA pytest plugin that automatically runs only…
permissive · top 5,000 on PyPI
pytest-threadleakA pytest plugin that detects when tests leak…
permissive · top 15,000 on PyPI
pytest-plusA pytest plugin that adds optional test-count…
permissive · top 15,000 on PyPI
pytest-ignore-test-resultsA pytest plugin that selectively ignores test…
permissive · top 15,000 on PyPI
pytest-deadfixturesA pytest plugin that identifies unused and…
permissive · top 5,000 on PyPI
pytest-richA pytest plugin that uses rich to format and…
permissive · top 15,000 on PyPI
pytest-emojiAdds emoji indicators to pytest test result…
permissive · top 15,000 on PyPI
exit-codesProvides platform-independent exit codes for…
permissive · top 15,000 on PyPI