Skip to main content

Run the tests related to the changed files

Project description

See Test Status on Github Actions See Package Status on Test PyPI 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)

Demo

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)

  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=main # if your parent branch differs from "master"

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 pip from PyPI:

$ pip install pytest-picked

Contributing

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.

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.

Project details


Download files

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

Source Distribution

pytest-picked-0.4.6.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

pytest_picked-0.4.6-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest-picked-0.4.6.tar.gz.

File metadata

  • Download URL: pytest-picked-0.4.6.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.0 requests-toolbelt/0.8.0 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for pytest-picked-0.4.6.tar.gz
Algorithm Hash digest
SHA256 e1ec7aee5d2cd3a91f676fd0afd7620a26c0ccc21e604152bbc5137f430e6c00
MD5 555799bd7a745188774387eecdbe828a
BLAKE2b-256 2691a84697adcf7b4d8a7ad3bd38a0cd3f210bbb3688d1cb9e8f7bd336f5c27b

See more details on using hashes here.

Provenance

File details

Details for the file pytest_picked-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: pytest_picked-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.0 requests-toolbelt/0.8.0 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for pytest_picked-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8bc744222a39ecc84cbcb87251fb69810ee576a80f84cc77fc47222818b3fa7c
MD5 f8635f4bd5a7d70d1c072e50baf1e475
BLAKE2b-256 a0d9ecabf6e5d1fd8089e38e618ef682ec0740152d9cf5e1b49d1a6215b84e60

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page