Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Run the tests related to the changed files

Project description

See Build Status on Travis CI See Build Status on AppVeyor See Package Status on PyPI Conda forge package Supported Python versions

Run the tests related to the unstaged files or the current branch (according to Git)


Let’s say you have the following output from git status:

$ git status

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

nothing added to commit but untracked files present (use "git add" to track)

Running pytest --picked, the plugin will run all tests that come from this output.

$ pytest --picked

============================= test session starts =============================
platform darwin -- Python 3.6.4, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
rootdir: /Users/ana.gomes/personal-workspace/grandma, inifile:
plugins: picked-0.1.0, mock-1.10.0, flask-0.10.0, deadfixtures-2.0.1
collecting 34 items
Changed test files... 1. ['tests/']
Changed test folders... 1. ['tests/api/']
collected 34 items

tests/ .                                                      [ 50%]
tests/api/ .                                                    [100%]

=========================== 2 passed in 0.07 seconds ===========================

All tests will be run from files and folders which are modified but not yet committed. No more copy and paste!


$ pytest --picked

$ pytest --picked=first

$ pytest --picked --mode=branch

$ pytest --picked --mode=unstaged  # default


Using git status, this plugin allows you to:

  • Run only tests from modified test files
  • Run tests from modified test files first, followed by all unmodified tests


You can install pytest-picked via pip from PyPI:

$ pip install pytest-picked


Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.


Distributed under the terms of the MIT license, “pytest-picked” is free and open source software


If you encounter any problems, please file an issue along with a detailed description.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-picked, version 0.4.4
Filename, size File type Python version Upload date Hashes
Filename, size pytest-picked-0.4.4.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page