pytest-picked is a pytest plugin (version 0.5.1) that enhances test execution by allowing users to run only the tests related to files changed according to Git. It's currently active and maintained, with releases on PyPI. This helps developers quickly test relevant code without running the entire test suite, particularly useful in continuous integration or local development workflows.
pip install pytest-pickedVerified import paths — ran on the pinned version, not inferred.
After installation, `pytest-picked` integrates with the `pytest` command. You run tests by invoking `pytest` with the `--picked` flag. By default, it runs tests from files with unstaged changes. You can specify different modes (e.g., `--mode=branch`) and a parent branch (`--parent-branch`) for more advanced selection based on Git history.
Always specify the desired `--mode` and `--parent-branch` (if applicable) when you need to deviate from the default 'unstaged' change detection.
Ensure your project is a Git repository, and that `git status` clearly shows the changes you expect `pytest-picked` to detect. Use Git commands to verify the state before running `pytest --picked` if unsure.
Before upgrading `pytest` to a new major version, check `pytest-picked`'s documentation or GitHub issues for known compatibility problems. Update `pytest-picked` to its latest version, if available, to ensure compatibility with newer `pytest` versions.