All Projects → asottile → covdefaults

asottile / covdefaults

Licence: MIT license
A coverage plugin to provide sensible default settings

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to covdefaults

Coveralls Python
Show coverage stats online via coveralls.io
Stars: ✭ 455 (+1097.37%)
Mutual labels:  coverage, pytest
pytest-notebook
A pytest plugin for regression testing and regenerating Jupyter Notebooks
Stars: ✭ 35 (-7.89%)
Mutual labels:  coverage, pytest
pytest-pycodestyle
pytest plugin to run pycodestyle
Stars: ✭ 15 (-60.53%)
Mutual labels:  pytest
pytest-mongodb
pytest plugin for mocking MongoDB with fixtures
Stars: ✭ 56 (+47.37%)
Mutual labels:  pytest
pytest-subprocess
Pytest plugin to fake subprocess.
Stars: ✭ 83 (+118.42%)
Mutual labels:  pytest
react-testing-mocha-chai-enzyme
A solid test setup for React components with Mocha, Chai, Sinon, Enzyme in a Webpack/Babel application.
Stars: ✭ 48 (+26.32%)
Mutual labels:  coverage
ts-node-starter
GitHub template to get started with Node.js & TypeScript. ⚡
Stars: ✭ 28 (-26.32%)
Mutual labels:  coverage
example-objc
Codecov example for Xcode
Stars: ✭ 24 (-36.84%)
Mutual labels:  coverage
jest-puppeteer-istanbul
Collect code coverage information from end-to-end jest puppeteer tests
Stars: ✭ 26 (-31.58%)
Mutual labels:  coverage
pytest-tap
Test Anything Protocol (TAP) reporting plugin for pytest
Stars: ✭ 34 (-10.53%)
Mutual labels:  pytest
ipython pytest
Pytest magic for IPython notebooks
Stars: ✭ 33 (-13.16%)
Mutual labels:  pytest
python-appium-framework
Complete Python Appium framework in 360 degree
Stars: ✭ 43 (+13.16%)
Mutual labels:  pytest
pytest-docker-tools
Opionated helpers for creating py.test fixtures for Docker integration and smoke testing environments
Stars: ✭ 61 (+60.53%)
Mutual labels:  pytest
publishing-python-packages
Examples and exercises for Publishing Python Packages from Manning Books 🐍 📦 ⬆️
Stars: ✭ 25 (-34.21%)
Mutual labels:  pytest
sonar-scala
A free and open-source SonarQube plugin for static code analysis of Scala projects.
Stars: ✭ 113 (+197.37%)
Mutual labels:  coverage
javadoc-coverage
A Doclet to generate JavaDoc coverage reports ☕️🧪📗
Stars: ✭ 23 (-39.47%)
Mutual labels:  coverage
salt-toaster
Salt Toaster: An ultimate test suite for Salt
Stars: ✭ 24 (-36.84%)
Mutual labels:  pytest
covers-validator
Validates covers tags in PHPUnit tests
Stars: ✭ 21 (-44.74%)
Mutual labels:  coverage
drf-chat-server-example
A chat server example used Django REST framework with pytest
Stars: ✭ 15 (-60.53%)
Mutual labels:  pytest
pytest-emoji
A pytest plugin that adds emojis to your test result report 😍
Stars: ✭ 41 (+7.89%)
Mutual labels:  pytest

Build Status Azure DevOps coverage pre-commit.ci status

covdefaults

A coverage plugin to provide sensible default settings

installation

pip install covdefaults

usage

to enable the plugin, add covdefaults to your coverage plugins

in .coveragerc:

[run]
plugins = covdefaults

in setup.cfg / tox.ini:

[coverage:run]
plugins = covdefaults

in pyproject.toml:

[tool.coverage.run]
plugins = ["covdefaults"]

default settings

[coverage:run]

branch = True
source = .
omit =
    */__main__.py
    */setup.py

[coverage:report]

show_missing = True
skip_covered = True
fail_under = 100
exclude_lines =
    # a more strict default pragma
    \# pragma: no cover\b

    # allow defensive code
    ^\s*raise AssertionError\b
    ^\s*raise NotImplementedError\b
    ^\s*return NotImplemented\b
    ^\s*raise$

    # typing-related code
    ^if (False|TYPE_CHECKING):
    : \.\.\.(\s*#.*)?$
    ^ +\.\.\.$
    -> ['"]?NoReturn['"]?:

    # non-runnable code
    if __name__ == ['"]__main__['"]:$

    # additional platform related pragmas (see below)
    # additional version related pragmas (see below)
partial_branches =
    # a more strict default pragma
    \# pragma: no cover\b

    # out platform pragmas
    \# pragma: (nt|posix|cygwin|darwin|linux|msys|win32|cpython|pypy) (no )?cover\b

    # our version pragmas
    \# pragma: (>=?|<=?|==|!=)\d+\.\d+ cover\b

platform specific # pragma: no cover

several # pragma: no cover tags will be added automatically based on the platform and implementation.

these will be in the form of:

# pragma: TAG no cover

or

# pragma: TAG cover

these tags will be generated by the following values:

  • os.name
    • nt (windows)
    • posix (linux, macOs, cygwin, etc.)
  • sys.platform
    • cygwin
    • darwin (macOs)
    • linux
    • msys
    • win32
  • sys.implementation.name
    • cpython
    • pypy

for every tag which does not match, you can use negation. here's an example:

if sys.platform == 'win32':  # pragma: win32 cover
    bin_dir = 'Scripts'
else:  # pragma: win32 no cover
    bin_dir = 'bin'

note here that # pragma: win32 cover will become a "no cover" for everything which is not win32 -- whereas the # pragma: win32 no cover will be a "no cover" only on win32.

version specific # pragma: no cover

several # pragma: no cover tags will be added automatically based on the platform and implementation.

these will be in the form of:

# pragma: >=#.# cover

where the comparison operator is one of >, >=, <, <=, ==, !=

for example:

if sys.version_info >= (3, 9):  # pragma: >=3.9 cover
    print('3.9+')
else:  # pragma: <3.9 cover
    print('old')

overriding options

several of the options can be overridden / extended in your coverage configuration. the examples below assume .coveragerc however any of the files coverage supports work as well.

run:omit

[run]
omit =
    pre_commit/resources/*

this will result in the pre_commit/resources/* being omitted in addition to the defaults provided by covdefaults.

[covdefaults]
subtract_omit = */__main__.py

this will result in */__main__.py not being omitted (*/__main__.py is among the defaults provided by covdefaults).

run:source

[run]
source = $PWD

covdefaults will not override this value to . if it is set manually.

report:exclude_lines

[report]
exclude_lines =
    ^if MYPY:$

this will result in lines matching ^if MYPY:$ to additionally be excluded from coverage in addition to the defaults provided by covdefaults.

report:fail_under

[report]
fail_under = 90

covdefaults will not change the value if you provide one for fail_under

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].