Permalink
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also .
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
- 18 commits
- 21 files changed
- 0 comments
- 6 contributors
Commits on Sep 05, 2020
I took a while to figure out why coverage wasn't working correctly for our large project until yesterday, when I read the paragraph that called out the `.coveragerc` options that `pytest-cov` ignores. This PR makes that part of the documentation "pop" a bit more. I considered moving it under "Caveats", but decided that that would mean rewriting "Caveats" to have two separate issues, rather than the one that it currently explains.
Commits on Nov 04, 2020
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
Commits on Jan 10, 2021
The empty 'console_scripts' entry point serves no purpose, and it is rather unlikely for it to contain any script in the near future. Its presence confuses Gentoo missing dependency checks.
Commits on Jan 11, 2021
Commits on Jan 18, 2021
Commits on Jan 19, 2021
Fix custom commands to handle additional arguments to the run() method.
This is needed with newer versions of setuptools since they've started
passing 'show_deprecation' kwarg in easy_install command, and this
resulted in the following error:
```
Traceback (most recent call last):
File "/tmp/pytest-cov/./setup.py", line 86, in <module>
setup(
File "/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.9/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/usr/lib/python3.9/site-packages/setuptools/command/install.py", line 117, in do_egg_install
cmd.run(show_deprecation=False)
TypeError: run() got an unexpected keyword argument 'show_deprecation'
```
While at it, future-proof all overriden commands to accept pass any
arguments through.
Unified
Split
Showing
with
154 additions
and 108 deletions.
- +5 −5 .appveyor.yml
- +3 −3 .bumpversion.cfg
- +3 −6 .cookiecutterrc
- +5 −1 .editorconfig
- +4 −1 .gitignore
- +26 −40 .travis.yml
- +5 −0 AUTHORS.rst
- +25 −0 CHANGELOG.rst
- +3 −2 CONTRIBUTING.rst
- +3 −3 README.rst
- +1 −1 docs/conf.py
- +10 −3 docs/config.rst
- +5 −8 examples/adhoc-layout/tox.ini
- +5 −8 examples/src-layout/tox.ini
- +10 −12 setup.py
- +1 −1 src/pytest_cov/__init__.py
- +3 −0 src/pytest_cov/embed.py
- +1 −0 src/pytest_cov/engine.py
- +1 −0 src/pytest_cov/plugin.py
- +10 −4 tests/test_pytest_cov.py
- +25 −10 tox.ini
| @@ -4,11 +4,11 @@ build: off | ||
| environment: | ||
| matrix: | ||
| - TOXENV: check | ||
| - TOXENV: 'py27-pytest46-xdist27-coverage45,py27-pytest46-xdist27-coverage52' | ||
| - TOXENV: 'py35-pytest46-xdist27-coverage45,py35-pytest46-xdist27-coverage52' | ||
| - TOXENV: 'py36-pytest46-xdist27-coverage45,py36-pytest46-xdist27-coverage52,py36-pytest46-xdist33-coverage45,py36-pytest46-xdist33-coverage52,py36-pytest54-xdist33-coverage45,py36-pytest54-xdist33-coverage52,py36-pytest60-xdist200-coverage52' | ||
| - TOXENV: 'py37-pytest46-xdist27-coverage45,py37-pytest46-xdist27-coverage52,py37-pytest46-xdist33-coverage45,py37-pytest46-xdist33-coverage52,py37-pytest54-xdist33-coverage45,py37-pytest54-xdist33-coverage52,py37-pytest60-xdist200-coverage52' | ||
| - TOXENV: 'pypy-pytest46-xdist27-coverage45,pypy-pytest46-xdist27-coverage52' | ||
| - TOXENV: 'py27-pytest46-xdist127-coverage52,py27-pytest46-xdist127-coverage53' | ||
| - TOXENV: 'py35-pytest46-xdist127-coverage52,py35-pytest46-xdist127-coverage53' | ||
| - TOXENV: 'py36-pytest46-xdist127-coverage52,py36-pytest46-xdist127-coverage53,py36-pytest46-xdist133-coverage53,py36-pytest54-xdist133-coverage53,py36-pytest62-xdist202-coverage53' | ||
| - TOXENV: 'py37-pytest46-xdist127-coverage52,py37-pytest46-xdist127-coverage53,py37-pytest46-xdist133-coverage53,py37-pytest54-xdist133-coverage53,py37-pytest62-xdist202-coverage53' | ||
| - TOXENV: 'pypy-pytest46-xdist127-coverage52,pypy-pytest46-xdist127-coverage53' | ||
|
|
||
| init: | ||
| - ps: echo $env:TOXENV | ||
| @@ -1,5 +1,5 @@ | ||
| [bumpversion] | ||
| current_version = 2.10.1 | ||
| current_version = 2.11.1 | ||
| commit = True | ||
| tag = True | ||
|
|
||
| @@ -8,8 +8,8 @@ search = version='{current_version}' | ||
| replace = version='{new_version}' | ||
|
|
||
| [bumpversion:file:README.rst] | ||
| search = v{current_version}. | ||
| replace = v{new_version}. | ||
| search = /v{current_version}.svg | ||
| replace = /v{new_version}.svg | ||
|
|
||
| [bumpversion:file:docs/conf.py] | ||
| search = version = release = '{current_version}' | ||
| @@ -1,9 +1,6 @@ | ||
| # Generated by cookiepatcher, a small shim around cookiecutter (pip install cookiepatcher) | ||
|
|
||
| cookiecutter: | ||
| _extensions: | ||
| - jinja2_time.TimeExtension | ||
| _template: /home/ionel/open-source/cookiecutter-pylibrary | ||
| default_context: | ||
| allow_tests_inside_package: no | ||
| appveyor: yes | ||
| c_extension_function: '-' | ||
| @@ -23,7 +20,7 @@ cookiecutter: | ||
| distribution_name: pytest-cov | ||
| email: contact@ionelmc.ro | ||
| full_name: Ionel Cristian Mărieș | ||
| landscape: no | ||
| legacy_python: yes | ||
| license: MIT license | ||
| linter: flake8 | ||
| package_name: pytest_cov | ||
| @@ -50,7 +47,7 @@ cookiecutter: | ||
| test_runner: pytest | ||
| travis: yes | ||
| travis_osx: no | ||
| version: 2.10.0 | ||
| version: 2.10.1 | ||
| website: http://blog.ionelmc.ro | ||
| year_from: '2010' | ||
| year_to: '2020' | ||
| @@ -2,10 +2,11 @@ | ||
| root = true | ||
|
|
||
| [*] | ||
| # Use Unix-style newlines for most files (except Windows files, see below). | ||
| end_of_line = lf | ||
| trim_trailing_whitespace = true | ||
| insert_final_newline = true | ||
| indent_style = space | ||
| insert_final_newline = true | ||
| indent_size = 4 | ||
| charset = utf-8 | ||
|
|
||
| @@ -14,3 +15,6 @@ end_of_line = crlf | ||
|
|
||
| [*.{yml,yaml}] | ||
| indent_size = 2 | ||
|
|
||
| [*.tsv] | ||
| indent_style = tab | ||
| @@ -39,11 +39,14 @@ htmlcov | ||
| # Translations | ||
| *.mo | ||
|
|
||
| # Mr Developer | ||
| # Buildout | ||
| .mr.developer.cfg | ||
|
|
||
| # IDE project files | ||
| .project | ||
| .pydevproject | ||
| .idea | ||
| .vscode | ||
| *.iml | ||
| *.komodoproject | ||
|
|
||
| @@ -20,69 +20,55 @@ jobs: | ||
| - env: TOXENV=docs | ||
|
|
||
| - stage: tests | ||
| env: TOXENV=py27-pytest46-xdist27-coverage45 | ||
| env: TOXENV=py27-pytest46-xdist127-coverage52 | ||
| python: '2.7' | ||
| - env: TOXENV=py27-pytest46-xdist27-coverage52 | ||
| - env: TOXENV=py27-pytest46-xdist127-coverage53 | ||
| python: '2.7' | ||
| - env: TOXENV=py35-pytest46-xdist27-coverage45 | ||
| - env: TOXENV=py35-pytest46-xdist127-coverage52 | ||
| python: '3.5' | ||
| - env: TOXENV=py35-pytest46-xdist27-coverage52 | ||
| - env: TOXENV=py35-pytest46-xdist127-coverage53 | ||
| python: '3.5' | ||
| - env: TOXENV=py36-pytest46-xdist27-coverage45 | ||
| - env: TOXENV=py36-pytest46-xdist127-coverage52 | ||
| python: '3.6' | ||
| - env: TOXENV=py36-pytest46-xdist27-coverage52 | ||
| - env: TOXENV=py36-pytest46-xdist127-coverage53 | ||
| python: '3.6' | ||
| - env: TOXENV=py37-pytest46-xdist27-coverage45 | ||
| - env: TOXENV=py37-pytest46-xdist127-coverage52 | ||
| python: '3.7' | ||
| - env: TOXENV=py37-pytest46-xdist27-coverage52 | ||
| - env: TOXENV=py37-pytest46-xdist127-coverage53 | ||
| python: '3.7' | ||
| - env: TOXENV=pypy-pytest46-xdist27-coverage45 | ||
| - env: TOXENV=pypy-pytest46-xdist127-coverage52 | ||
| python: 'pypy' | ||
| - env: TOXENV=pypy-pytest46-xdist27-coverage52 | ||
| - env: TOXENV=pypy-pytest46-xdist127-coverage53 | ||
| python: 'pypy' | ||
| - env: TOXENV=pypy3-pytest46-xdist27-coverage45 | ||
| - env: TOXENV=pypy3-pytest46-xdist127-coverage52 | ||
| python: 'pypy3' | ||
| - env: TOXENV=pypy3-pytest46-xdist27-coverage52 | ||
| - env: TOXENV=pypy3-pytest46-xdist127-coverage53 | ||
| python: 'pypy3' | ||
| - env: TOXENV=py36-pytest46-xdist33-coverage45 | ||
| - env: TOXENV=py36-pytest46-xdist133-coverage53 | ||
| python: '3.6' | ||
| - env: TOXENV=py36-pytest46-xdist33-coverage52 | ||
| - env: TOXENV=py36-pytest54-xdist133-coverage53 | ||
| python: '3.6' | ||
| - env: TOXENV=py36-pytest54-xdist33-coverage45 | ||
| python: '3.6' | ||
| - env: TOXENV=py36-pytest54-xdist33-coverage52 | ||
| python: '3.6' | ||
| - env: TOXENV=py37-pytest46-xdist33-coverage45 | ||
| python: '3.7' | ||
| - env: TOXENV=py37-pytest46-xdist33-coverage52 | ||
| python: '3.7' | ||
| - env: TOXENV=py37-pytest54-xdist33-coverage45 | ||
| - env: TOXENV=py37-pytest46-xdist133-coverage53 | ||
| python: '3.7' | ||
| - env: TOXENV=py37-pytest54-xdist33-coverage52 | ||
| - env: TOXENV=py37-pytest54-xdist133-coverage53 | ||
| python: '3.7' | ||
| - env: TOXENV=py38-pytest46-xdist33-coverage45 | ||
| - env: TOXENV=py38-pytest46-xdist133-coverage53 | ||
| python: '3.8' | ||
| - env: TOXENV=py38-pytest46-xdist33-coverage52 | ||
| - env: TOXENV=py38-pytest54-xdist133-coverage53 | ||
| python: '3.8' | ||
| - env: TOXENV=py38-pytest54-xdist33-coverage45 | ||
| python: '3.8' | ||
| - env: TOXENV=py38-pytest54-xdist33-coverage52 | ||
| python: '3.8' | ||
| - env: TOXENV=pypy3-pytest46-xdist33-coverage45 | ||
| python: 'pypy3' | ||
| - env: TOXENV=pypy3-pytest46-xdist33-coverage52 | ||
| python: 'pypy3' | ||
| - env: TOXENV=pypy3-pytest54-xdist33-coverage45 | ||
| - env: TOXENV=pypy3-pytest46-xdist133-coverage53 | ||
| python: 'pypy3' | ||
| - env: TOXENV=pypy3-pytest54-xdist33-coverage52 | ||
| - env: TOXENV=pypy3-pytest54-xdist133-coverage53 | ||
| python: 'pypy3' | ||
| - env: TOXENV=py36-pytest60-xdist200-coverage52 | ||
| - env: TOXENV=py36-pytest62-xdist202-coverage53 | ||
| python: '3.6' | ||
| - env: TOXENV=py37-pytest60-xdist200-coverage52 | ||
| - env: TOXENV=py37-pytest62-xdist202-coverage53 | ||
| python: '3.7' | ||
| - env: TOXENV=py38-pytest60-xdist200-coverage52 | ||
| - env: TOXENV=py38-pytest62-xdist202-coverage53 | ||
| python: '3.8' | ||
| - env: TOXENV=pypy3-pytest60-xdist200-coverage52 | ||
| - env: TOXENV=py39-pytest62-xdist202-coverage53 | ||
| python: '3.9' | ||
| - env: TOXENV=pypy3-pytest62-xdist202-coverage53 | ||
| python: 'pypy3' | ||
|
|
||
| - stage: examples | ||
| @@ -39,3 +39,8 @@ Authors | ||
| * Michael Manganiello - https://github.com/adamantike | ||
| * Anders Hovmöller - https://github.com/boxed | ||
| * Zac Hatfield-Dodds - https://zhd.dev | ||
| * Mateus Berardo de Souza Terra - https://github.com/MatTerra | ||
| * Ganden Schaffner - https://github.com/gschaffner | ||
| * Michał Górny - https://github.com/mgorny | ||
| * Bernát Gábor - https://github.com/gaborbernat | ||
| * Pamela McA'Nulty - https://github.com/PamelaM | ||
| @@ -1,6 +1,31 @@ | ||
| Changelog | ||
| ========= | ||
|
|
||
| 2.11.1 (2021-01-20) | ||
| ------------------- | ||
|
|
||
| * Fixed support for newer setuptools (v42+). | ||
| Contributed by Michał Górny in `#451 <https://github.com/pytest-dev/pytest-cov/pull/451>`_. | ||
|
|
||
| 2.11.0 (2021-01-18) | ||
| ------------------- | ||
|
|
||
| * Bumped minimum coverage requirement to 5.2.1. This prevents reporting issues. | ||
| Contributed by Mateus Berardo de Souza Terra in `#433 <https://github.com/pytest-dev/pytest-cov/pull/433>`_. | ||
| * Improved sample projects (from the `examples <https://github.com/pytest-dev/pytest-cov/tree/master/examples>`_ | ||
| directory) to support running `tox -e pyXY`. Now the example configures a suffixed coverage data file, | ||
| and that makes the cleanup environment unnecessary. | ||
| Contributed by Ganden Schaffner in `#435 <https://github.com/pytest-dev/pytest-cov/pull/435>`_. | ||
| * Removed the empty `console_scripts` entrypoint that confused some Gentoo build script. | ||
| I didn't ask why it was so broken cause I didn't want to ruin my day. | ||
| Contributed by Michał Górny in `#434 <https://github.com/pytest-dev/pytest-cov/pull/434>`_. | ||
| * Fixed the missing `coverage context <https://coverage.readthedocs.io/en/stable/contexts.html>`_ | ||
| when using subprocesses. | ||
| Contributed by Bernát Gábor in `#443 <https://github.com/pytest-dev/pytest-cov/pull/443>`_. | ||
| * Updated the config section in the docs. | ||
| Contributed by Pamela McA'Nulty in `#429 <https://github.com/pytest-dev/pytest-cov/pull/429>`_. | ||
| * Migrated CI to travis-ci.com (from .org). | ||
|
|
||
| 2.10.1 (2020-08-14) | ||
| ------------------- | ||
|
|
||
| @@ -74,7 +74,8 @@ For merging, you should: | ||
| 4. Add yourself to ``AUTHORS.rst``. | ||
|
|
||
| .. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will | ||
| `run the tests <https://travis-ci.org/pytest-dev/pytest-cov/pull_requests>`_ for each change you add in the pull request. | ||
| `run the tests <https://travis-ci.com//github/pytest-dev/pytest-cov/pull_requests>`_ | ||
| for each change you add in the pull request. | ||
| It will be slower though ... | ||
| @@ -85,6 +86,6 @@ To run a subset of tests:: | ||
|
|
||
| tox -e envname -- pytest -k test_myfeature | ||
|
|
||
| To run the test environments in *parallel*:: | ||
| To run all the test environments in *parallel*:: | ||
|
|
||
| tox -p auto | ||
| @@ -19,9 +19,9 @@ Overview | ||
| :target: https://readthedocs.org/projects/pytest-cov | ||
| :alt: Documentation Status | ||
|
|
||
| .. |travis| image:: https://api.travis-ci.org/pytest-dev/pytest-cov.svg?branch=master | ||
| .. |travis| image:: https://api.travis-ci.com/pytest-dev/pytest-cov.svg?branch=master | ||
| :alt: Travis-CI Build Status | ||
| :target: https://travis-ci.org/pytest-dev/pytest-cov | ||
| :target: https://travis-ci.com/github/pytest-dev/pytest-cov | ||
|
|
||
| .. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/pytest-dev/pytest-cov?branch=master&svg=true | ||
| :alt: AppVeyor Build Status | ||
| @@ -38,7 +38,7 @@ Overview | ||
| .. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/pytest-cov.svg | ||
| :target: https://anaconda.org/conda-forge/pytest-cov | ||
|
|
||
| .. |commits-since| image:: https://img.shields.io/github/commits-since/pytest-dev/pytest-cov/v2.10.1.svg | ||
| .. |commits-since| image:: https://img.shields.io/github/commits-since/pytest-dev/pytest-cov/v2.11.1.svg | ||
| :alt: Commits since latest release | ||
| :target: https://github.com/pytest-dev/pytest-cov/compare/v2.10.1...master | ||
|
|
||
| @@ -26,7 +26,7 @@ | ||
| year = '2016' | ||
| author = 'pytest-cov contributors' | ||
| copyright = '{}, {}'.format(year, author) | ||
| version = release = '2.10.1' | ||
| version = release = '2.11.1' | ||
|
|
||
| pygments_style = 'trac' | ||
| templates_path = ['.'] | ||
| @@ -21,9 +21,16 @@ For full details refer to the `coverage config file`_ documentation. | ||
|
|
||
| .. _`coverage config file`: https://coverage.readthedocs.io/en/latest/config.html | ||
|
|
||
| Note that this plugin controls some options and setting the option in the config file will have no | ||
| effect. These include specifying source to be measured (source option) and all data file handling | ||
| (data_file and parallel options). | ||
| .. note:: Important Note | ||
|
|
||
| This plugin overrides the ``data_file`` and ``parallel`` options of coverage. Unless you also run coverage without | ||
| pytest-cov it's pointless to set those options in your ``.coveragerc``. | ||
|
|
||
| If you use the ``--cov=something`` option (with a value) then coverage's ``source`` option will also get overriden. | ||
| If you have multiple sources it might be easier to set those in ``.coveragerc`` and always use ``--cov`` (wihout a value) | ||
| instead of having a long command line with ``--cov=pkg1 --cov=pkg2 --cov=pkg3 ...``. | ||
|
|
||
| If you use the ``--cov-branch`` option then coverage's ``branch`` option will also get overriden. | ||
|
|
||
| If you wish to always add pytest-cov with pytest, you can use ``addopts`` under ``pytest`` or ``tool:pytest`` section. | ||
| For example: :: | ||
| @@ -1,12 +1,14 @@ | ||
| [tox] | ||
| envlist = clean,py27,py38,report | ||
| envlist = py27,py38,report | ||
|
|
||
| [tool:pytest] | ||
| addopts = | ||
| --cov-report=term-missing | ||
|
|
||
| [testenv] | ||
| commands = pytest --cov --cov-append --cov-config={toxinidir}/.coveragerc {posargs:-vv} | ||
| setenv = | ||
| py{27,38}: COVERAGE_FILE = .coverage.{envname} | ||
| commands = pytest --cov --cov-config={toxinidir}/.coveragerc {posargs:-vv} | ||
| deps = | ||
| pytest | ||
| coverage | ||
| @@ -17,7 +19,6 @@ deps = | ||
| ../.. | ||
|
|
||
| depends = | ||
| {py27,py38}: clean | ||
| report: py27,py38 | ||
|
|
||
| # note that this is necessary to prevent the tests importing the code from your badly laid project | ||
| @@ -27,10 +28,6 @@ changedir = tests | ||
| skip_install = true | ||
| deps = coverage | ||
| commands = | ||
| coverage combine | ||
| coverage html | ||
| coverage report --fail-under=100 | ||
|
|
||
| [testenv:clean] | ||
| skip_install = true | ||
| deps = coverage | ||
| commands = coverage erase | ||
| @@ -1,13 +1,15 @@ | ||
| [tox] | ||
| envlist = clean,py27,py38,report | ||
| envlist = py27,py38,report | ||
|
|
||
| [tool:pytest] | ||
| testpaths = tests | ||
| addopts = | ||
| --cov-report=term-missing | ||
|
|
||
| [testenv] | ||
| commands = pytest --cov --cov-append {posargs:-vv} | ||
| setenv = | ||
| py{27,38}: COVERAGE_FILE = .coverage.{envname} | ||
| commands = pytest --cov {posargs:-vv} | ||
| deps = | ||
| pytest | ||
| coverage | ||
| @@ -18,17 +20,12 @@ deps = | ||
| ../.. | ||
|
|
||
| depends = | ||
| {py27,py38}: clean | ||
| report: py27,py38 | ||
|
|
||
| [testenv:report] | ||
| skip_install = true | ||
| deps = coverage | ||
| commands = | ||
| coverage combine | ||
| coverage html | ||
| coverage report --fail-under=100 | ||
|
|
||
| [testenv:clean] | ||
| skip_install = true | ||
| deps = coverage | ||
| commands = coverage erase | ||
Oops, something went wrong.