Registry / testing / pytest-runner

pytest-runner

JSON →
library6.0.1pypypiunverified

pytest-runner is a setuptools extension that historically allowed pytest to be invoked via `python setup.py test`. Version 6.0.1 is the latest release, but the project is officially deprecated and its GitHub repository was archived in December 2023. It is no longer recommended for use in modern Python projects due to reliance on deprecated setuptools features and security concerns.

pip install pytest-runner
INSTALL
IMPORT
SIG · PYTEST-RUNNER
P
pytest-runner
testingpythonv6.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

This is the *deprecated* quickstart method for `pytest-runner`. It demonstrates how to configure your `setup.py` to use `pytest-runner` to enable the `python setup.py pytest` (or `test`) command. Modern projects are advised to run `pytest` directly or via tools like `tox`.

# In setup.py (NOTE: This usage pattern is deprecated!) from setuptools import setup, find_packages setup( name='my-package', version='0.1.0', packages=find_packages(), setup_requires=[ 'pytest-runner', ], tests_require=[ 'pytest', ], ) # To run tests (from your project root): # python setup.py pytest # OR python setup.py test (if 'test=pytest' alias is set in setup.cfg)
Debug
Known issues
breakingThe `pytest-runner` project is officially deprecated and its GitHub repository was archived in December 2023. The `setup.py test` command it enables is also being deprecated and slated for removal by `setuptools` itself. You should migrate away from `pytest-runner` for all projects.
fix
Remove `pytest-runner` from `setup_requires` and `pytest` from `tests_require` in your `setup.py`. Instead, invoke `pytest` directly (e.g., `python -m pytest` or `pytest`) or use a dedicated test orchestration tool like `tox`. Configure `pytest` using `pyproject.toml`, `pytest.ini`, or `setup.cfg`'s `[tool:pytest]` section.
affects: <=6.0.1
gotcha`pytest-runner` (and the `setup_requires`/`tests_require` mechanism it relies upon) can bypass security mechanisms in `pip`, specifically `pip --require-hashes`. This can lead to insecure dependency resolution.
fix
Follow the deprecation migration path by removing `pytest-runner` and invoking `pytest` directly. Manage test dependencies explicitly in `pyproject.toml` or `requirements.txt` for better security and reproducibility.
affects: <=6.0.1
gotchaFor new projects, or migrating existing ones, `pytest-runner` is unnecessary. `pytest` should be installed as a regular development dependency, typically specified in `pyproject.toml` (`[project.optional-dependencies]`) or `requirements-dev.txt`, and invoked directly from the command line (e.g., `pytest` or `python -m pytest`).
fix
Ensure `pytest` is listed as a development dependency. Remove `pytest-runner` and any `setup_requires` or `tests_require` sections related to testing from `setup.py`. Configure `pytest` using `pyproject.toml`, `pytest.ini`, or `setup.cfg`.
affects: <=6.0.1
breakingThe script failed because the `setuptools` package was not found. This typically occurs when a Python script (especially a `setup.py` file) attempts to import `setuptools` without it being installed in the active environment.
fix
Ensure `setuptools` is installed in your Python environment. You can install it using `pip install setuptools`. If you are running this in a container or isolated environment, ensure `setuptools` is included in the environment's dependencies (e.g., in a `requirements.txt` or a Dockerfile).
affects: all
Upgrade
Version history
6.0.1latest on PyPI · released Dec 4, 2023
Audit
Dependencies
pytestrequiredCore test runner that pytest-runner integrates with.
setuptoolsrequiredBuild system that pytest-runner extends, specifically leveraging `setup_requires` and `tests_require` which are now deprecated.
Agent activity
11 hits · last 30 days
node
10
Resources
pytest-runner — pip install pytest-runner · libregistry