Coder Social home page Coder Social logo

pytest-picked's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.