Skip to main content

pytest-picked

See Test Status on Github Actions

PyPI version

Conda forge package

Supported Python versions

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


Demo

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

$ git status

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

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

  api.py
  tests/api/
  tests/test_board.py

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/test_board.py']
Changed test folders... 1. ['tests/api/']
collected 34 items

tests/test_board.py .                                                      [ 50%]
tests/api/test_new.py .                                                    [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!

Usage

pytest --picked

pytest --picked=first

pytest --picked --mode=branch

pytest --picked --mode=unstaged  # default

pytest --picked --mode=branch --parent-branch=dev # if your parent branch differs from "main"

Features

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

Installation

You can install pytest-picked via PyPI:

pip install pytest-picked

Contributing

Contributions are very welcome. Tests can be run with tox, so we can guarantee that it is working in different python versions. Also, make sure to add tests and use pre-commit before you submit a pull request.

License

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

Issues

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

Release files for pytest-picked 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-picked 0.5.1
File Size Uploaded
pytest_picked-0.5.1.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-picked 0.5.1
File Interpreter ABI Platform
pytest_picked-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / pytest_picked-0.5.1.tar.gz

Download URL pytest_picked-0.5.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6634c4356a560a5dc3dba35471865e6eb06bbd356b56b69c540593e9d5620ded
BLAKE2b-256 checksum
How to use checksums
bae451a54dd6638fd4a7c45bb20a737235fd92cbb4d24b5ff681d64ace5d02e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / pytest_picked-0.5.1-py3-none-any.whl

Download URL pytest_picked-0.5.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af65c4763b51dc095ae4bc5073a962406902422ad9629c26d8b01122b677d998
BLAKE2b-256 checksum
How to use checksums
c681450c017746caab376c4b6700439de9f1cc7d8e1f22dec3c1eb235cd9ad3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.6

2 release files

0.4.4

1 release file

0.4.1

1 release file

0.4.0

2 release files

0.3.2

2 release files

0.3.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page