Coder Social home page Coder Social logo

jayvdb / pytest-fastest Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kstrauser/pytest-fastest

0.0 3.0 0.0 71 KB

Use Git and coverage data to run only needed tests

Home Page: http://pytest-fastest.readthedocs.io/en/latest/

License: MIT License

Python 100.00%

pytest-fastest's Introduction

pytest-fastest

PyPI version

Python versions

See Build Status on Travis CI

See Build Status on AppVeyor

Use SCM and coverage to run only needed tests


This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template.

Features

  • Gathers coverage data from tests to track which tests call functions from which modules.
  • Uses Git to track changes from a given commit to find the minimum set of tests that need to run to test new changes, then skips everything else.

Requirements

  • Python 3.5+
  • pytest 3.4.0+

Installation

You can install "pytest-fastest" via pip from PyPI:

$ pip install pytest-fastest

Usage

pytest-fastest can be set to run only tests:

  • That test modules that have changed in Git,
  • Tests that we don't already have coverage data for, and
  • Tests that we've added or changed.

In most common development workflows where you make short-lived branches off a main "master" or "dev" branch, the amount of code that actually changes while fixing a bug or writing a feature is usually just a small portion of the whole codebase. Instead of running thousands of tests after each change, pytest-fastest can identify the relevant ones that thoroughly test your work but skip all the things you haven't changed.

To use it:

  • In pytest.ini, set fastest_commit to the name of a Git commit to compare your current work against. (You can also set or override it on the comment line with --fastest-commit). This is required if you want to skip tests, which is the main reason for using this plugin.
  • Use the command line argument --fastest-mode to choice the appropriate running mode:
    • all (default): Run all tests without collecting coverage data. This emulates normal pytest behavior and has no effect on performance.
    • skip: Skip tests that don't need to be run, but update coverage data on the ones that do run. This will usually be faster than all, but because collecting coverage information takes some time, as the number of un-skippable tests grows very large it may actually become slower.
    • gather: Don't skip any tests, but do gather coverage data. This is slower than all but can be used to seed the coverage cache.
    • cache: This is a fast mode for fixing existing tests. It skips tests but doesn't update the coverage cache. It will never be slower than all and will always be faster than skip.

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-fastest" is free and open source software

Issues

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

pytest-fastest's People

Contributors

kstrauser avatar

Watchers

John Vandenberg avatar James Cloos avatar  avatar

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.