pytest-cov

Coverage plugin for pytest.

https://github.com/pytest-dev/pytest-cov

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 95 committers (1.1%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary

Keywords

pytest python

Keywords from Contributors

unit-testing closember templates pallets jinja apps views requests asyncio distributed
Last synced: 6 months ago · JSON representation

Repository

Coverage plugin for pytest.

Basic Info
  • Host: GitHub
  • Owner: pytest-dev
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 1.05 MB
Statistics
  • Stars: 1,947
  • Watchers: 41
  • Forks: 218
  • Open Issues: 152
  • Releases: 0
Topics
pytest python
Created almost 12 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Security Authors

README.rst

========
Overview
========

.. start-badges

.. list-table::
    :stub-columns: 1

    * - docs
      - |docs|
    * - tests
      - |github-actions|
    * - package
      - |version| |conda-forge| |wheel| |supported-versions| |supported-implementations| |commits-since|
.. |docs| image:: https://readthedocs.org/projects/pytest-cov/badge/?style=flat
    :target: https://readthedocs.org/projects/pytest-cov/
    :alt: Documentation Status

.. |github-actions| image:: https://github.com/pytest-dev/pytest-cov/actions/workflows/test.yml/badge.svg
    :alt: GitHub Actions Status
    :target: https://github.com/pytest-dev/pytest-cov/actions

.. |version| image:: https://img.shields.io/pypi/v/pytest-cov.svg
    :alt: PyPI Package latest release
    :target: https://pypi.org/project/pytest-cov

.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/pytest-cov.svg
    :target: https://anaconda.org/conda-forge/pytest-cov
.. |wheel| image:: https://img.shields.io/pypi/wheel/pytest-cov.svg
    :alt: PyPI Wheel
    :target: https://pypi.org/project/pytest-cov

.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/pytest-cov.svg
    :alt: Supported versions
    :target: https://pypi.org/project/pytest-cov

.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/pytest-cov.svg
    :alt: Supported implementations
    :target: https://pypi.org/project/pytest-cov

.. |commits-since| image:: https://img.shields.io/github/commits-since/pytest-dev/pytest-cov/v6.3.0.svg
    :alt: Commits since latest release
    :target: https://github.com/pytest-dev/pytest-cov/compare/v6.3.0...master

.. end-badges

This plugin produces coverage reports. Compared to just using ``coverage run`` this plugin does some extras:

* Subprocess support: you can fork or run stuff in a subprocess and will get covered without any fuss.
* Xdist support: you can use all of pytest-xdist's features and still get coverage.
* Consistent pytest behavior. If you run ``coverage run -m pytest`` you will have slightly different ``sys.path`` (CWD will be
  in it, unlike when running ``pytest``).

All features offered by the coverage package should work, either through pytest-cov's command line options or
through coverage's config file.

* Free software: MIT license

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

Install with pip::

    pip install pytest-cov

For distributed testing support install pytest-xdist::

    pip install pytest-xdist

Upgrading from ancient pytest-cov
---------------------------------

`pytest-cov 2.0` is using a new ``.pth`` file (``pytest-cov.pth``). You may want to manually remove the older
``init_cov_core.pth`` from site-packages as it's not automatically removed.

Uninstalling
------------

Uninstall with pip::

    pip uninstall pytest-cov

Under certain scenarios a stray ``.pth`` file may be left around in site-packages.

* `pytest-cov 2.0` may leave a ``pytest-cov.pth`` if you installed without wheels
  (``easy_install``, ``setup.py install`` etc).
* `pytest-cov 1.8 or older` will leave a ``init_cov_core.pth``.

Usage
=====

::

    pytest --cov=myproj tests/

Would produce a report like::

    -------------------- coverage: ... ---------------------
    Name                 Stmts   Miss  Cover
    ----------------------------------------
    myproj/__init__          2      0   100%
    myproj/myproj          257     13    94%
    myproj/feature4286      94      7    92%
    ----------------------------------------
    TOTAL                  353     20    94%

Documentation
=============

https://pytest-cov.readthedocs.io/en/latest/






Coverage Data File
==================

The data file is erased at the beginning of testing to ensure clean data for each test run. If you
need to combine the coverage of several test runs you can use the ``--cov-append`` option to append
this coverage data to coverage data from previous test runs.

The data file is left at the end of testing so that it is possible to use normal coverage tools to
examine it.

Limitations
===========

For distributed testing the workers must have the pytest-cov package installed. This is needed since
the plugin must be registered through setuptools for pytest to start the plugin on the
worker.

For subprocess measurement environment variables must make it from the main process to the
subprocess. The python used by the subprocess must have pytest-cov installed. The subprocess must
do normal site initialisation so that the environment variables can be detected and coverage
started. See the `subprocess support docs `_
for more details of how this works.

Security
========

To report a security vulnerability please use the `Tidelift security contact `_.
Tidelift will coordinate the fix and disclosure.

Acknowledgements
================

Whilst this plugin has been built fresh from the ground up it has been influenced by the work done
on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and nose-cover (Jason Pellerin) which are
other coverage plugins.

Ned Batchelder for coverage and its ability to combine the coverage results of parallel runs.

Holger Krekel for pytest with its distributed testing support.

Jason Pellerin for nose.

Michael Foord for unittest2.

No doubt others have contributed to these tools as well.

Owner

  • Name: pytest-dev
  • Login: pytest-dev
  • Kind: organization
  • Email: pytest-dev@python.org
  • Location: Everywhere

GitHub Events

Total
  • Issues event: 41
  • Watch event: 166
  • Delete event: 10
  • Issue comment event: 172
  • Push event: 35
  • Pull request review comment event: 39
  • Pull request review event: 49
  • Pull request event: 33
  • Fork event: 13
  • Create event: 13
Last Year
  • Issues event: 41
  • Watch event: 166
  • Delete event: 10
  • Issue comment event: 172
  • Push event: 35
  • Pull request review comment event: 39
  • Pull request review event: 49
  • Pull request event: 33
  • Fork event: 13
  • Create event: 13

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 933
  • Total Committers: 95
  • Avg Commits per committer: 9.821
  • Development Distribution Score (DDS): 0.487
Past Year
  • Commits: 71
  • Committers: 6
  • Avg Commits per committer: 11.833
  • Development Distribution Score (DDS): 0.282
Top Committers
Name Email Commits
Ionel Cristian Mărieș c****t@i****o 479
schlamar m****h@g****m 101
Meme Dough m****h@g****m 83
Daniel Hahler g****t@t****e 38
Thomas Grainger t****n@g****m 24
Hugo van Kemenade h****k 22
Tsvika Shapira t****s@g****m 14
Ned Batchelder n****d@n****m 14
David Szotten d****n@g****m 14
pre-commit-ci[bot] 6****] 9
Rick van Hattem W****h@w****h 8
Bruno Oliveira n****s@g****m 8
Christian Clauss c****s@m****m 5
Christian Ledermann c****n@g****m 4
Saurabh Kumar s****h@s****m 4
Sorin Sbarnea s****a@g****m 3
Buck Golemon w****r@g****m 3
Michael Manganiello a****e 3
Michał Górny m****y@g****g 3
Zoltan Kozma z****t@b****k 3
Feilong Niu n****g@w****m 3
Patrick Lannigan p****n@g****m 3
Yuki Kobayashi d****r@g****m 3
Terence D. Honles t****e@h****m 2
Harm Geerts h****s@o****l 2
Jeremy Bowman j****n@e****g 2
Jonathan Stewmon j****n@b****m 2
Marc Abramowitz m****c@m****m 2
Michael Elovskikh w****k@y****u 2
Ryan Hiebert r****n@r****m 2
and 65 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 157
  • Total pull requests: 100
  • Average time to close issues: 5 months
  • Average time to close pull requests: 5 months
  • Total issue authors: 137
  • Total pull request authors: 47
  • Average comments per issue: 4.32
  • Average comments per pull request: 2.63
  • Merged pull requests: 51
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 37
  • Pull requests: 34
  • Average time to close issues: 14 days
  • Average time to close pull requests: 5 days
  • Issue authors: 34
  • Pull request authors: 10
  • Average comments per issue: 3.11
  • Average comments per pull request: 1.65
  • Merged pull requests: 21
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • webknjaz (5)
  • ego-thales (4)
  • ssbarnea (3)
  • adamjstewart (3)
  • cjw296 (2)
  • abrisco (2)
  • brunolnetto (2)
  • nedbat (2)
  • jaraco (2)
  • masaccio (2)
  • asmeurer (2)
  • kloczek (2)
  • cclauss (2)
  • FaridDelgadoTR (1)
  • alittlesir (1)
Pull Request Authors
  • ionelmc (20)
  • cclauss (10)
  • tsvikas (4)
  • ssbarnea (4)
  • koyuki7w (4)
  • akx (4)
  • tserg (2)
  • s-t-e-v-e-n-k (2)
  • mbyrnepr2 (2)
  • davet2001 (2)
  • didibz-harmonya (2)
  • jongbinjung (2)
  • ofek (2)
  • edcarter (2)
  • mikemanger (2)
Top Labels
Issue Labels
upstream (3) discussion needed (3) bug (3) wontfix (2) question (2) enhancement (1) invalid (1) feedback (1) help wanted (1)
Pull Request Labels
skip-changelog (6) bug (6) discussion needed (3) needs more work (2) help wanted (1) question (1) dependencies (1) github_actions (1) enhancement (1)

Packages

  • Total packages: 24
  • Total downloads:
    • pypi 78,722,764 last-month
  • Total docker downloads: 2,989,637,519
  • Total dependent packages: 11,656
    (may contain duplicates)
  • Total dependent repositories: 88,908
    (may contain duplicates)
  • Total versions: 117
  • Total maintainers: 3
pypi.org: pytest-cov

Pytest plugin for measuring coverage.

  • Versions: 52
  • Dependent Packages: 11,611
  • Dependent Repositories: 86,636
  • Downloads: 78,722,764 Last month
  • Docker Downloads: 2,989,637,519
Rankings
Dependent packages count: 0.0%
Dependent repos count: 0.0%
Docker downloads count: 0.0%
Downloads: 0.0%
Average: 1.2%
Stargazers count: 2.3%
Forks count: 4.7%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.18: py3-pytest-cov-pyc

Precompiled Python bytecode for py3-pytest-cov

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 3.4%
Stargazers count: 6.6%
Forks count: 6.8%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.18: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 3.4%
Stargazers count: 6.6%
Forks count: 6.8%
Maintainers (1)
Last synced: 6 months ago
spack.io: py-pytest-cov

Pytest plugin for measuring coverage.

  • Versions: 4
  • Dependent Packages: 10
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 5.0%
Stargazers count: 6.3%
Dependent packages count: 6.7%
Forks count: 7.1%
Maintainers (1)
Last synced: about 1 year ago
conda-forge.org: pytest-cov
  • Versions: 19
  • Dependent Packages: 35
  • Dependent Repositories: 1,136
Rankings
Dependent repos count: 0.7%
Dependent packages count: 1.9%
Average: 6.5%
Stargazers count: 10.7%
Forks count: 12.8%
Last synced: 6 months ago
alpine-v3.13: py3-pytest-cov

Pytest plugin for measuring coverage.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.5%
Forks count: 5.1%
Average: 7.3%
Dependent packages count: 19.5%
Maintainers (1)
Last synced: 6 months ago
alpine-edge: py3-pytest-cov-pyc

Precompiled Python bytecode for py3-pytest-cov

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 7.5%
Forks count: 8.2%
Stargazers count: 8.3%
Dependent packages count: 13.4%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.12: py3-pytest-cov

Pytest plugin for measuring coverage.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 3.9%
Forks count: 4.6%
Average: 7.5%
Dependent packages count: 21.5%
Maintainers (1)
Last synced: 6 months ago
alpine-edge: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 7.7%
Forks count: 8.0%
Stargazers count: 8.1%
Dependent packages count: 14.6%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.11: py3-pytest-cov

Pytest plugin for measuring coverage.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.0%
Forks count: 4.6%
Average: 7.8%
Dependent packages count: 22.6%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.14: py3-pytest-cov

Pytest plugin for measuring coverage.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.5%
Forks count: 5.1%
Average: 7.8%
Dependent packages count: 21.7%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.15: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.8%
Forks count: 5.3%
Average: 8.9%
Dependent packages count: 25.6%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.10: py3-pytest-cov

Pytest plugin for measuring coverage.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 3.5%
Forks count: 4.1%
Average: 9.3%
Dependent packages count: 29.6%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.16: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 5.2%
Forks count: 5.4%
Average: 9.5%
Dependent packages count: 27.3%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.17: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 6.6%
Forks count: 6.8%
Average: 10.2%
Dependent packages count: 27.3%
Maintainers (1)
Last synced: 6 months ago
anaconda.org: pytest-cov

This plugin produces coverage reports. Compared to just using coverage run this plugin does some extras: * Subprocess support: you can fork or run stuff in a subprocess and will get covered without any fuss. * Xdist support: you can use all of pytest-xdist's features and still get coverage. * Consistent pytest behavior. If you run coverage run -m pytest you will have slightly different sys.path (CWD will be in it, unlike when running pytest). All features offered by the coverage package should work, either through pytest-cov's command line options or through coverage's config file.

  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 1,136
Rankings
Dependent repos count: 4.0%
Stargazers count: 20.1%
Forks count: 23.2%
Average: 24.6%
Dependent packages count: 51.2%
Last synced: 6 months ago
alpine-v3.22: py3-pytest-cov-pyc

Precompiled Python bytecode for py3-pytest-cov

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.19: py3-pytest-cov-pyc

Precompiled Python bytecode for py3-pytest-cov

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.21: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.21: py3-pytest-cov-pyc

Precompiled Python bytecode for py3-pytest-cov

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.22: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.20: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.20: py3-pytest-cov-pyc

Precompiled Python bytecode for py3-pytest-cov

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.19: py3-pytest-cov

Pytest plugin for measuring coverage

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/test.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • re-actors/alls-green release/v1 composite
ci/requirements.txt pypi
  • pip >=19.1.1
  • setuptools >=18.0.1
  • six >=1.14.0
  • tox *
  • virtualenv >=16.6.0
docs/requirements.txt pypi
  • docutils ==0.16
  • jinja2 <3.1
  • sphinx ==3.0.3
  • sphinx-py3doc-enhanced-theme ==2.4.0
setup.py pypi
  • coverage *
  • pytest >=4.6