pytest-cov-exclude


Namepytest-cov-exclude JSON
Version 0.0.9 PyPI version JSON
download
home_pagehttps://github.com/mhallin/cov-exclude-py
SummaryPytest plugin for excluding tests based on coverage data
upload_time2016-04-29 08:56:36
maintainer
docs_urlNone
authorMagnus Hallin
requires_python
licenseMIT
keywords cover coverage pytest py.test performance speed
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            ======================================
 Pytest Coverage-based Test Exclusion
======================================

.. image:: https://api.travis-ci.org/mhallin/cov-exclude-py.svg?branch=master
   :target: https://travis-ci.org/mhallin/cov-exclude-py

.. image:: https://img.shields.io/pypi/v/pytest-cov-exclude.svg
   :target: https://pypi.python.org/pypi/pytest-cov-exclude

Coverage-based test exclusion plugin for pytest_. By looking at which
lines are executed by each test, the next test run can be sped up by
*not* executing the tests where no source files have changed.

If you have a large test suite which you often re-run, this plugin can
drastically improve the iteration times.


Installation
============

Install with pip:

.. code-block:: text

   $ pip install pytest-cov-exclude

``pytest-cov-exclude`` requires Pytest 2.8 or later. It is compatible with
Python 2.7, 3.3, 3.4, 3.5, as well as PyPy. It does *not* work on PyPy
3 due to an unknown bug with the coverage data generated.


Usage
=====

The first time you run your test suite, per-test coverage is enabled
and the suite will take a *little bit* longer than usual:

.. code-block:: text

   $ py.test

   ==================== test session starts =====================

   # Test output...

   ================ MANY passed in MANY seconds =================

Now when you re-run the test suite, all tests should have been
excluded:

.. code-block:: text

   $ py.test

   ==================== test session starts =====================

   # Test output...

   =============== MANY deselected in FEW seconds ===============

If a test fails, it will re-run even if nothing changed in order to
preserve the general failure status of the test suite.


Forcing individual test inclusion
---------------------------------

If you have tests that depend on files not included in coverage data,
such as data files or generated sources, you can mark the tests with
``external_dependencies``. This forces them to be re-run even if no
files were changed:

.. code-block:: python

   @pytest.mark.external_dependencies
   def test_something():
       # Run tests from external data files


Known bugs
----------

* Changes to files during pytest's collection phase will be
  ignored. Test files and their dependencies are scanned as soon as
  possible *after* the test collection is complete.

  There is a test case marked ``xfail`` that highlights this issue.


Running the whole test suite
----------------------------

If you want to force a complete re-run of the whole test suite, you
have two options: either disable the plugin, or clear pytest's cache:

.. code-block:: text

   $ py.test -p no:cov-exclude  # Disable the plugin

   $ py.test --cache-clear  # Clear pytest's cache


Compatibility
=============

As stated earlier, this plugin requires Pytest 2.8 or later since it
depends on the new cache module.

While PyPy is supported, the ujson_ library used for faster
serialization/deserialization is not available, so a fallback to the
default JSON implementation is used instead. Because of this, the
tests might actually run *slower* with this plugin under PyPy.

.. _pytest: http://pytest.org
.. _ujson: https://pypi.python.org/pypi/ujson
            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "cover,coverage,pytest,py.test,performance,speed", 
    "upload_time": "2016-04-29 08:56:36", 
    "author": "Magnus Hallin", 
    "home_page": "https://github.com/mhallin/cov-exclude-py", 
    "github_user": "mhallin", 
    "download_url": "https://pypi.python.org/packages/3e/55/e4c346205bc51efe8632fc419b15349a8ea297fe32fce03bf684c10e2d0c/pytest-cov-exclude-0.0.9.tar.gz", 
    "platform": "UNKNOWN", 
    "version": "0.0.9", 
    "cheesecake_documentation_id": null, 
    "description": "======================================\n Pytest Coverage-based Test Exclusion\n======================================\n\n.. image:: https://api.travis-ci.org/mhallin/cov-exclude-py.svg?branch=master\n   :target: https://travis-ci.org/mhallin/cov-exclude-py\n\n.. image:: https://img.shields.io/pypi/v/pytest-cov-exclude.svg\n   :target: https://pypi.python.org/pypi/pytest-cov-exclude\n\nCoverage-based test exclusion plugin for pytest_. By looking at which\nlines are executed by each test, the next test run can be sped up by\n*not* executing the tests where no source files have changed.\n\nIf you have a large test suite which you often re-run, this plugin can\ndrastically improve the iteration times.\n\n\nInstallation\n============\n\nInstall with pip:\n\n.. code-block:: text\n\n   $ pip install pytest-cov-exclude\n\n``pytest-cov-exclude`` requires Pytest 2.8 or later. It is compatible with\nPython 2.7, 3.3, 3.4, 3.5, as well as PyPy. It does *not* work on PyPy\n3 due to an unknown bug with the coverage data generated.\n\n\nUsage\n=====\n\nThe first time you run your test suite, per-test coverage is enabled\nand the suite will take a *little bit* longer than usual:\n\n.. code-block:: text\n\n   $ py.test\n\n   ==================== test session starts =====================\n\n   # Test output...\n\n   ================ MANY passed in MANY seconds =================\n\nNow when you re-run the test suite, all tests should have been\nexcluded:\n\n.. code-block:: text\n\n   $ py.test\n\n   ==================== test session starts =====================\n\n   # Test output...\n\n   =============== MANY deselected in FEW seconds ===============\n\nIf a test fails, it will re-run even if nothing changed in order to\npreserve the general failure status of the test suite.\n\n\nForcing individual test inclusion\n---------------------------------\n\nIf you have tests that depend on files not included in coverage data,\nsuch as data files or generated sources, you can mark the tests with\n``external_dependencies``. This forces them to be re-run even if no\nfiles were changed:\n\n.. code-block:: python\n\n   @pytest.mark.external_dependencies\n   def test_something():\n       # Run tests from external data files\n\n\nKnown bugs\n----------\n\n* Changes to files during pytest's collection phase will be\n  ignored. Test files and their dependencies are scanned as soon as\n  possible *after* the test collection is complete.\n\n  There is a test case marked ``xfail`` that highlights this issue.\n\n\nRunning the whole test suite\n----------------------------\n\nIf you want to force a complete re-run of the whole test suite, you\nhave two options: either disable the plugin, or clear pytest's cache:\n\n.. code-block:: text\n\n   $ py.test -p no:cov-exclude  # Disable the plugin\n\n   $ py.test --cache-clear  # Clear pytest's cache\n\n\nCompatibility\n=============\n\nAs stated earlier, this plugin requires Pytest 2.8 or later since it\ndepends on the new cache module.\n\nWhile PyPy is supported, the ujson_ library used for faster\nserialization/deserialization is not available, so a fallback to the\ndefault JSON implementation is used instead. Because of this, the\ntests might actually run *slower* with this plugin under PyPy.\n\n.. _pytest: http://pytest.org\n.. _ujson: https://pypi.python.org/pypi/ujson", 
    "tox": true, 
    "lcname": "pytest-cov-exclude", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": true, 
    "name": "pytest-cov-exclude", 
    "license": "MIT", 
    "travis_ci": true, 
    "github_project": "cov-exclude-py", 
    "summary": "Pytest plugin for excluding tests based on coverage data", 
    "split_keywords": [
        "cover", 
        "coverage", 
        "pytest", 
        "py.test", 
        "performance", 
        "speed"
    ], 
    "author_email": "mhallin@fastmail.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2016-04-29T08:56:36", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/3e/55/e4c346205bc51efe8632fc419b15349a8ea297fe32fce03bf684c10e2d0c/pytest-cov-exclude-0.0.9.tar.gz", 
            "md5_digest": "85d68987c7581ced152817fce65389b8", 
            "downloads": 0, 
            "filename": "pytest-cov-exclude-0.0.9.tar.gz", 
            "packagetype": "sdist", 
            "path": "3e/55/e4c346205bc51efe8632fc419b15349a8ea297fe32fce03bf684c10e2d0c/pytest-cov-exclude-0.0.9.tar.gz", 
            "size": 7063
        }, 
        {
            "has_sig": false, 
            "upload_time": "2016-04-29T08:56:26", 
            "comment_text": "", 
            "python_version": "py2.py3", 
            "url": "https://pypi.python.org/packages/21/27/c63af4ce00ce26000ac82e78228f7de4f273e54f3c628aa79d9699abaabd/pytest_cov_exclude-0.0.9-py2.py3-none-any.whl", 
            "md5_digest": "020d94d68423db21f440c674aa00504e", 
            "downloads": 0, 
            "filename": "pytest_cov_exclude-0.0.9-py2.py3-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "21/27/c63af4ce00ce26000ac82e78228f7de4f273e54f3c628aa79d9699abaabd/pytest_cov_exclude-0.0.9-py2.py3-none-any.whl", 
            "size": 11249
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}