From c2dfa778a85c1f64f3f59007b8d8ca98c877cac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Thu, 4 Mar 2021 14:09:21 +0200 Subject: [PATCH 01/46] Update test deps. Remove unnecessary assertion. Closes #452. --- .appveyor.yml | 10 ++++---- .travis.yml | 50 +++++++++++++++------------------------- tests/test_pytest_cov.py | 11 --------- tox.ini | 10 ++++---- 4 files changed, 30 insertions(+), 51 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 8c776417..fde3a6aa 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,11 +4,11 @@ build: off environment: matrix: - TOXENV: check - - 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' + - TOXENV: 'py27-pytest46-xdist127-coverage55' + - TOXENV: 'py35-pytest46-xdist127-coverage55' + - TOXENV: 'py36-pytest46-xdist127-coverage55,py36-pytest46-xdist133-coverage55,py36-pytest54-xdist133-coverage55,py36-pytest62-xdist202-coverage55' + - TOXENV: 'py37-pytest46-xdist127-coverage55,py37-pytest46-xdist133-coverage55,py37-pytest54-xdist133-coverage55,py37-pytest62-xdist202-coverage55' + - TOXENV: 'pypy-pytest46-xdist127-coverage55' init: - ps: echo $env:TOXENV diff --git a/.travis.yml b/.travis.yml index db6e815a..a9cafa4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,55 +20,43 @@ jobs: - env: TOXENV=docs - stage: tests - env: TOXENV=py27-pytest46-xdist127-coverage52 + env: TOXENV=py27-pytest46-xdist127-coverage55 python: '2.7' - - env: TOXENV=py27-pytest46-xdist127-coverage53 - python: '2.7' - - env: TOXENV=py35-pytest46-xdist127-coverage52 - python: '3.5' - - env: TOXENV=py35-pytest46-xdist127-coverage53 + - env: TOXENV=py35-pytest46-xdist127-coverage55 python: '3.5' - - env: TOXENV=py36-pytest46-xdist127-coverage52 - python: '3.6' - - env: TOXENV=py36-pytest46-xdist127-coverage53 + - env: TOXENV=py36-pytest46-xdist127-coverage55 python: '3.6' - - env: TOXENV=py37-pytest46-xdist127-coverage52 + - env: TOXENV=py37-pytest46-xdist127-coverage55 python: '3.7' - - env: TOXENV=py37-pytest46-xdist127-coverage53 - python: '3.7' - - env: TOXENV=pypy-pytest46-xdist127-coverage52 - python: 'pypy' - - env: TOXENV=pypy-pytest46-xdist127-coverage53 + - env: TOXENV=pypy-pytest46-xdist127-coverage55 python: 'pypy' - - env: TOXENV=pypy3-pytest46-xdist127-coverage52 - python: 'pypy3' - - env: TOXENV=pypy3-pytest46-xdist127-coverage53 + - env: TOXENV=pypy3-pytest46-xdist127-coverage55 python: 'pypy3' - - env: TOXENV=py36-pytest46-xdist133-coverage53 + - env: TOXENV=py36-pytest46-xdist133-coverage55 python: '3.6' - - env: TOXENV=py36-pytest54-xdist133-coverage53 + - env: TOXENV=py36-pytest54-xdist133-coverage55 python: '3.6' - - env: TOXENV=py37-pytest46-xdist133-coverage53 + - env: TOXENV=py37-pytest46-xdist133-coverage55 python: '3.7' - - env: TOXENV=py37-pytest54-xdist133-coverage53 + - env: TOXENV=py37-pytest54-xdist133-coverage55 python: '3.7' - - env: TOXENV=py38-pytest46-xdist133-coverage53 + - env: TOXENV=py38-pytest46-xdist133-coverage55 python: '3.8' - - env: TOXENV=py38-pytest54-xdist133-coverage53 + - env: TOXENV=py38-pytest54-xdist133-coverage55 python: '3.8' - - env: TOXENV=pypy3-pytest46-xdist133-coverage53 + - env: TOXENV=pypy3-pytest46-xdist133-coverage55 python: 'pypy3' - - env: TOXENV=pypy3-pytest54-xdist133-coverage53 + - env: TOXENV=pypy3-pytest54-xdist133-coverage55 python: 'pypy3' - - env: TOXENV=py36-pytest62-xdist202-coverage53 + - env: TOXENV=py36-pytest62-xdist202-coverage55 python: '3.6' - - env: TOXENV=py37-pytest62-xdist202-coverage53 + - env: TOXENV=py37-pytest62-xdist202-coverage55 python: '3.7' - - env: TOXENV=py38-pytest62-xdist202-coverage53 + - env: TOXENV=py38-pytest62-xdist202-coverage55 python: '3.8' - - env: TOXENV=py39-pytest62-xdist202-coverage53 + - env: TOXENV=py39-pytest62-xdist202-coverage55 python: '3.9' - - env: TOXENV=pypy3-pytest62-xdist202-coverage53 + - env: TOXENV=pypy3-pytest62-xdist202-coverage55 python: 'pypy3' - stage: examples diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 3c730504..0d1b5a23 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -498,10 +498,6 @@ def test_central_coveragerc(testdir, prop): 'test_central_coveragerc* %s *' % prop.result, '*10 passed*', ]) - - # single-module coverage report - assert all(not line.startswith('TOTAL ') for line in result.stdout.lines[-4:]) - assert result.ret == 0 @@ -536,10 +532,6 @@ def test_central_with_path_aliasing(testdir, monkeypatch, opts, prop): 'src[\\/]mod* %s *' % prop.result, '*10 passed*', ]) - - # single-module coverage report - assert all(not line.startswith('TOTAL ') for line in result.stdout.lines[-4:]) - assert result.ret == 0 @@ -642,9 +634,6 @@ def test_show_missing_coveragerc(testdir, prop): '*10 passed*', ]) - # single-module coverage report - assert all(not line.startswith('TOTAL ') for line in result.stdout.lines[-4:]) - assert result.ret == 0 diff --git a/tox.ini b/tox.ini index 279db82e..6be986e9 100644 --- a/tox.ini +++ b/tox.ini @@ -13,9 +13,9 @@ passenv = [tox] envlist = check - py{27,35,36,37,py,py3}-pytest46-xdist127-coverage{52,53} - py{36,37,38,py3}-pytest{46,54}-xdist133-coverage{53} - py{36,37,38,39,py3}-pytest{62}-xdist202-coverage{53} + py{27,35,36,37,py,py3}-pytest46-xdist127-coverage{55} + py{36,37,38,py3}-pytest{46,54}-xdist133-coverage{55} + py{36,37,38,39,py3}-pytest{62}-xdist202-coverage{55} docs [testenv] @@ -29,7 +29,7 @@ setenv = pytest54: _DEP_PYTEST=pytest==5.4.3 pytest60: _DEP_PYTEST=pytest==6.0.2 pytest61: _DEP_PYTEST=pytest==6.1.2 - pytest62: _DEP_PYTEST=pytest==6.2.1 + pytest62: _DEP_PYTEST=pytest==6.2.2 xdist127: _DEP_PYTESTXDIST=pytest-xdist==1.27.0 xdist129: _DEP_PYTESTXDIST=pytest-xdist==1.29.0 @@ -47,6 +47,8 @@ setenv = coverage51: _DEP_COVERAGE=coverage==5.1 coverage52: _DEP_COVERAGE=coverage==5.2.1 coverage53: _DEP_COVERAGE=coverage==5.3.1 + coverage54: _DEP_COVERAGE=coverage==5.4 + coverage55: _DEP_COVERAGE=coverage==5.5 # For testing against a coverage.py working tree. coveragedev: _DEP_COVERAGE=-e{env:COVERAGE_HOME} passenv = From daf54e79fcb8f549699d28e691302a9251f7e54b Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Wed, 24 Mar 2021 12:07:33 +0100 Subject: [PATCH 02/46] Added toml as extra (#410) * added toml extra * Update AUTHORS.rst * Update CHANGELOG.rst * chain toml dependency to coverage's toml dependency Co-authored-by: Thomas Grainger * move coverage's toml dependency from extras to install_requires * udpate changelog phrase Co-authored-by: Thomas Grainger --- AUTHORS.rst | 1 + CHANGELOG.rst | 7 +++++++ setup.py | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 30d5907b..8c715b1e 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -44,3 +44,4 @@ Authors * Michał Górny - https://github.com/mgorny * Bernát Gábor - https://github.com/gaborbernat * Pamela McA'Nulty - https://github.com/PamelaM +* Christian Riedel - https://github.com/Cielquan diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cc865bfe..904fa0d8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Changelog ========= + +2.12.0 (2021-03-??) +------------------- + +* Added coverage's `toml` extra to install requirements in setup.py. + Contributed by Christian Riedel in `#410 `_. + 2.11.1 (2021-01-20) ------------------- diff --git a/setup.py b/setup.py index 7abccf58..a00ae0af 100755 --- a/setup.py +++ b/setup.py @@ -124,7 +124,7 @@ def run(self): ], install_requires=[ 'pytest>=4.6', - 'coverage>=5.2.1' + 'coverage[toml]>=5.2.1' ], python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', extras_require={ From fb2c67ea0832ef75259db9209908508eab1e0a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20=C5=A0egan?= Date: Thu, 25 Mar 2021 15:53:16 +0100 Subject: [PATCH 03/46] Implement --cov-reset option that resets accumulated --cov directories to an empty list. --- docs/config.rst | 2 ++ src/pytest_cov/plugin.py | 2 ++ tests/test_pytest_cov.py | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/docs/config.rst b/docs/config.rst index 0dfb17a0..6aa0e411 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -66,6 +66,8 @@ The complete list of command line options is: False --no-cov Disable coverage report completely (useful for debuggers). Default: False + --cov-reset Reset cov sources accumulated in options so far. + Mostly useful for scripts and configuration files. --cov-fail-under=MIN Fail if the total coverage is less than MIN. --cov-append Do not delete coverage but append to current. Default: False diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index b875f409..3662cfbb 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -70,6 +70,8 @@ def pytest_addoption(parser): nargs='?', const=True, dest='cov_source', help='Path or package name to measure during execution (multi-allowed). ' 'Use --cov= to not do any source filtering and record everything.') + group.addoption('--cov-reset', action='store_const', const=[], dest='cov_source', + help='Reset cov sources accumulated in options so far. ') group.addoption('--cov-report', action=StoreReport, default={}, metavar='TYPE', type=validate_report, help='Type of report to generate: term, term-missing, ' diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 0d1b5a23..2647edfd 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -1999,6 +1999,33 @@ def test_double_cov2(testdir): assert result.ret == 0 +def test_cov_reset(testdir): + script = testdir.makepyfile(SCRIPT_SIMPLE) + result = testdir.runpytest('-v', + '--assert=plain', + '--cov=%s' % script.dirpath(), + '--cov-reset', + script) + + assert 'coverage: platform' not in result.stdout.str() + + +def test_cov_reset_then_set(testdir): + script = testdir.makepyfile(SCRIPT_SIMPLE) + result = testdir.runpytest('-v', + '--assert=plain', + '--cov=%s' % script.dirpath(), + '--cov-reset', + '--cov=%s' % script.dirpath(), + script) + + result.stdout.fnmatch_lines([ + '*- coverage: platform *, python * -*', + 'test_cov_reset_then_set* %s*' % SCRIPT_SIMPLE_RESULT, + '*1 passed*' + ]) + + @pytest.mark.skipif('sys.platform == "win32" and platform.python_implementation() == "PyPy"') def test_cov_and_no_cov(testdir): script = testdir.makepyfile(SCRIPT_SIMPLE) From 2cd009442ddb08dc873117019b13ef972803d5c4 Mon Sep 17 00:00:00 2001 From: Chris Sreesangkom Date: Wed, 12 May 2021 10:04:47 -0700 Subject: [PATCH 04/46] change in setup.py from BSD to MIT to match LICENSE file (#467) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a00ae0af..ba885db1 100755 --- a/setup.py +++ b/setup.py @@ -102,7 +102,7 @@ def run(self): 'Development Status :: 5 - Production/Stable', 'Framework :: Pytest', 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', + 'License :: OSI Approved :: MIT License', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Operating System :: Unix', From f5a4d7e008087913ce2bc9dc2305d05a5f545a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Thu, 13 May 2021 16:05:31 +0300 Subject: [PATCH 05/46] Fix version value. Fixes #468. --- src/pytest_cov/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pytest_cov/__init__.py b/src/pytest_cov/__init__.py index 12142c14..00b8d837 100644 --- a/src/pytest_cov/__init__.py +++ b/src/pytest_cov/__init__.py @@ -1,2 +1,2 @@ """pytest-cov: avoid already-imported warning: PYTEST_DONT_REWRITE.""" -__version__ = "__version__ = '2.11.1'" +__version__ = '2.11.1' From f2ee249e7214b9cad53f56fe33b6c8012a8ef08e Mon Sep 17 00:00:00 2001 From: Terence Honles Date: Fri, 14 May 2021 02:03:29 -0700 Subject: [PATCH 06/46] fix link in readme (#470) --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 6fd04ad7..63d18f7b 100644 --- a/README.rst +++ b/README.rst @@ -40,7 +40,7 @@ Overview .. |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 + :target: https://github.com/pytest-dev/pytest-cov/compare/v2.11.1...master .. |wheel| image:: https://img.shields.io/pypi/wheel/pytest-cov.svg :alt: PyPI Wheel From 62d2e94debe6230e0160b1d5f711ae7f42158e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 14 May 2021 13:22:12 +0300 Subject: [PATCH 07/46] Fix configuration file, ref f2ee249. --- .bumpversion.cfg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 95330435..cea38d79 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -7,10 +7,14 @@ tag = True search = version='{current_version}' replace = version='{new_version}' -[bumpversion:file:README.rst] +[bumpversion:file (badge):README.rst] search = /v{current_version}.svg replace = /v{new_version}.svg +[bumpversion:file (link):README.rst] +search = /v{current_version}...master +replace = /v{new_version}...master + [bumpversion:file:docs/conf.py] search = version = release = '{current_version}' replace = version = release = '{new_version}' From f533121b78d479ee4bf0c3c09b48d9513523ffb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 14 May 2021 13:29:57 +0300 Subject: [PATCH 08/46] Update changelog. --- AUTHORS.rst | 1 + CHANGELOG.rst | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 8c715b1e..d3d01d11 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -45,3 +45,4 @@ Authors * Bernát Gábor - https://github.com/gaborbernat * Pamela McA'Nulty - https://github.com/PamelaM * Christian Riedel - https://github.com/Cielquan +* Chris Sreesangkom - https://github.com/csreesan diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 904fa0d8..23e9a3b9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,11 +2,17 @@ Changelog ========= -2.12.0 (2021-03-??) +2.12.0 (2021-05-14) ------------------- * Added coverage's `toml` extra to install requirements in setup.py. Contributed by Christian Riedel in `#410 `_. +* Fixed ``pytest_cov.__version__`` to have the right value (string with version instead of a string + including ``__version__ =``). +* Fixed license classifier in ``setup.py``. + Contributed by Chris Sreesangkom in `#467 `_. +* Fixed *commits since* badge. + Contributed by Terence Honles in `#470 `_. 2.11.1 (2021-01-20) ------------------- From 9692bad8c3501b77cf950d0732ae9cb5c8bb0bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 14 May 2021 14:32:34 +0300 Subject: [PATCH 09/46] =?UTF-8?q?Bump=20version:=202.11.1=20=E2=86=92=202.?= =?UTF-8?q?12.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 3 +-- README.rst | 4 ++-- docs/conf.py | 2 +- setup.py | 2 +- src/pytest_cov/__init__.py | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index cea38d79..7e15ff94 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.11.1 +current_version = 2.12.0 commit = True tag = True @@ -22,4 +22,3 @@ replace = version = release = '{new_version}' [bumpversion:file:src/pytest_cov/__init__.py] search = __version__ = '{current_version}' replace = __version__ = '{new_version}' - diff --git a/README.rst b/README.rst index 63d18f7b..a0c44a71 100644 --- a/README.rst +++ b/README.rst @@ -38,9 +38,9 @@ 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.11.1.svg +.. |commits-since| image:: https://img.shields.io/github/commits-since/pytest-dev/pytest-cov/v2.12.0.svg :alt: Commits since latest release - :target: https://github.com/pytest-dev/pytest-cov/compare/v2.11.1...master + :target: https://github.com/pytest-dev/pytest-cov/compare/v2.12.0...master .. |wheel| image:: https://img.shields.io/pypi/wheel/pytest-cov.svg :alt: PyPI Wheel diff --git a/docs/conf.py b/docs/conf.py index c774b421..1da75b8a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ year = '2016' author = 'pytest-cov contributors' copyright = '{}, {}'.format(year, author) -version = release = '2.11.1' +version = release = '2.12.0' pygments_style = 'trac' templates_path = ['.'] diff --git a/setup.py b/setup.py index ba885db1..ca77760c 100755 --- a/setup.py +++ b/setup.py @@ -85,7 +85,7 @@ def run(self): setup( name='pytest-cov', - version='2.11.1', + version='2.12.0', license='MIT', description='Pytest plugin for measuring coverage.', long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), diff --git a/src/pytest_cov/__init__.py b/src/pytest_cov/__init__.py index 00b8d837..a9f1cb62 100644 --- a/src/pytest_cov/__init__.py +++ b/src/pytest_cov/__init__.py @@ -1,2 +1,2 @@ """pytest-cov: avoid already-imported warning: PYTEST_DONT_REWRITE.""" -__version__ = '2.11.1' +__version__ = '2.12.0' From 297965e05a7712e50c2f8a4dc26cd189132aba22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 14 May 2021 14:37:02 +0300 Subject: [PATCH 10/46] Update appveyor envs. Workaround pypy install problem. --- .appveyor.yml | 23 ++++++++++++++++++++++- ci/templates/.appveyor.yml | 23 ++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index fde3a6aa..6ee159e9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,9 @@ # NOTE: this file is auto-generated via ci/bootstrap.py (ci/templates/.appveyor.yml). version: '{branch}-{build}' build: off +image: + - Visual Studio 2015 + - Visual Studio 2019 environment: matrix: - TOXENV: check @@ -8,8 +11,26 @@ environment: - TOXENV: 'py35-pytest46-xdist127-coverage55' - TOXENV: 'py36-pytest46-xdist127-coverage55,py36-pytest46-xdist133-coverage55,py36-pytest54-xdist133-coverage55,py36-pytest62-xdist202-coverage55' - TOXENV: 'py37-pytest46-xdist127-coverage55,py37-pytest46-xdist133-coverage55,py37-pytest54-xdist133-coverage55,py37-pytest62-xdist202-coverage55' + - TOXENV: 'py38-pytest46-xdist133-coverage55,py38-pytest54-xdist133-coverage55,py38-pytest62-xdist202-coverage55' + - TOXENV: 'py39-pytest62-xdist202-coverage55' - TOXENV: 'pypy-pytest46-xdist127-coverage55' - + - TOXENV: 'pypy3-pytest46-xdist127-coverage55,pypy3-pytest46-xdist133-coverage55,pypy3-pytest54-xdist133-coverage55,pypy3-pytest62-xdist202-coverage55' +matrix: + exclude: + - image: Visual Studio 2015 + TOXENV: 'py27-pytest46-xdist127-coverage55' + - image: Visual Studio 2019 + TOXENV: 'py36-pytest46-xdist127-coverage55,py36-pytest46-xdist133-coverage55,py36-pytest54-xdist133-coverage55,py36-pytest62-xdist202-coverage55' + - image: Visual Studio 2019 + TOXENV: 'py37-pytest46-xdist127-coverage55,py37-pytest46-xdist133-coverage55,py37-pytest54-xdist133-coverage55,py37-pytest62-xdist202-coverage55' + - image: Visual Studio 2019 + TOXENV: 'py38-pytest46-xdist133-coverage55,py38-pytest54-xdist133-coverage55,py38-pytest62-xdist202-coverage55' + - image: Visual Studio 2019 + TOXENV: 'py39-pytest62-xdist202-coverage55' + - image: Visual Studio 2019 + TOXENV: 'pypy-pytest46-xdist127-coverage55' + - image: Visual Studio 2019 + TOXENV: 'pypy3-pytest46-xdist127-coverage55,pypy3-pytest46-xdist133-coverage55,pypy3-pytest54-xdist133-coverage55,pypy3-pytest62-xdist202-coverage55' init: - ps: echo $env:TOXENV - ps: ls C:\Python* diff --git a/ci/templates/.appveyor.yml b/ci/templates/.appveyor.yml index 92630e15..01ca3493 100644 --- a/ci/templates/.appveyor.yml +++ b/ci/templates/.appveyor.yml @@ -1,5 +1,8 @@ version: '{branch}-{build}' build: off +image: + - Visual Studio 2015 + - Visual Studio 2019 environment: matrix: - TOXENV: check @@ -7,8 +10,26 @@ environment: - TOXENV: '{{ py35_environments|join(",") }}' - TOXENV: '{{ py36_environments|join(",") }}' - TOXENV: '{{ py37_environments|join(",") }}' + - TOXENV: '{{ py38_environments|join(",") }}' + - TOXENV: '{{ py39_environments|join(",") }}' - TOXENV: '{{ pypy_environments|join(",") }}' - + - TOXENV: '{{ pypy3_environments|join(",") }}' +matrix: + exclude: + - image: Visual Studio 2015 + TOXENV: '{{ py27_environments|join(",") }}' + - image: Visual Studio 2019 + TOXENV: '{{ py36_environments|join(",") }}' + - image: Visual Studio 2019 + TOXENV: '{{ py37_environments|join(",") }}' + - image: Visual Studio 2019 + TOXENV: '{{ py38_environments|join(",") }}' + - image: Visual Studio 2019 + TOXENV: '{{ py39_environments|join(",") }}' + - image: Visual Studio 2019 + TOXENV: '{{ pypy_environments|join(",") }}' + - image: Visual Studio 2019 + TOXENV: '{{ pypy3_environments|join(",") }}' init: - ps: echo $env:TOXENV - ps: ls C:\Python* From edc60bb9e560d7ea53056590a64a4e5c81b5e62c Mon Sep 17 00:00:00 2001 From: Brian Rutledge Date: Tue, 1 Jun 2021 05:47:05 -0400 Subject: [PATCH 11/46] Document `show_contexts` (#473) --- docs/contexts.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/contexts.rst b/docs/contexts.rst index e5256fcc..c502c1d6 100644 --- a/docs/contexts.rst +++ b/docs/contexts.rst @@ -2,10 +2,12 @@ Contexts ======== -Coverage.py 5.0 can record separate coverage data for different contexts during +Coverage.py 5.0 can record separate coverage data for `different contexts`_ during one run of a test suite. Pytest-cov can use this feature to record coverage data for each test individually, with the ``--cov-context=test`` option. +.. _`different_contexts`: https://coverage.readthedocs.io/en/stable/contexts.html + The context name recorded in the coverage.py database is the pytest test id, and the phase of execution, one of "setup", "run", or "teardown". These two are separated with a pipe symbol. You might see contexts like:: @@ -16,3 +18,12 @@ are separated with a pipe symbol. You might see contexts like:: Note that parameterized tests include the values of the parameters in the test id, and each set of parameter values is recorded as a separate test. + +To view contexts when using ``--cov-report=html``, add this to your ``.coveragerc``:: + + [html] + show_contexts = True + +The HTML report will include an annotation on each covered line, indicating the +number of contexts that executed the line. Clicking the annotation displays a +list of the contexts. From 34edfa1cf80f8d722dec4f587b10d2783f89a0f0 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 1 Jun 2021 10:51:23 +0100 Subject: [PATCH 12/46] Avoid using toml as extra (#472) Avoid pip-compile bug which forces it to produce invalid constraints files. Installing toml as a direct dependency is enough to avoid this bug. Related: https://github.com/jazzband/pip-tools/issues/1300 --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ca77760c..ebb7e9b0 100755 --- a/setup.py +++ b/setup.py @@ -124,7 +124,8 @@ def run(self): ], install_requires=[ 'pytest>=4.6', - 'coverage[toml]>=5.2.1' + 'coverage>=5.2.1', + 'toml' ], python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', extras_require={ From ac7cc916268266807d43e9d7f0bcb1ae4277010c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 1 Jun 2021 13:00:56 +0300 Subject: [PATCH 13/46] Update changelog. --- AUTHORS.rst | 2 ++ CHANGELOG.rst | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index d3d01d11..14cb7781 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -46,3 +46,5 @@ Authors * Pamela McA'Nulty - https://github.com/PamelaM * Christian Riedel - https://github.com/Cielquan * Chris Sreesangkom - https://github.com/csreesan +* Sorin Sbarnea - https://github.com/ssbarnea +* Brian Rutledge - https://github.com/bhrutledge diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 23e9a3b9..ef5ad741 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog ========= +2.12.1 (2021-06-01) +------------------- + +* Changed the `toml` requirement to be always be directly required (instead of being required through a coverage extra). + This fixes issues with pip-compile (`pip-tools#1300 `_). + Contributed by Sorin Sbarnea in `#472 `_. +* Documented ``show_contexts``. + Contributed by Brian Rutledge in `#473 `_. 2.12.0 (2021-05-14) ------------------- From 17252e0896ac18d7b15284d8dc4e2ecb16b050c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 1 Jun 2021 13:02:22 +0300 Subject: [PATCH 14/46] Remove unnecessary pin. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ebb7e9b0..d3f9f133 100755 --- a/setup.py +++ b/setup.py @@ -132,7 +132,7 @@ def run(self): 'testing': [ 'fields', 'hunter', - 'process-tests==2.0.2', + 'process-tests', 'six', 'pytest-xdist', 'virtualenv', From df20c973a5a34c4e085362dcf41df88fc3ee6297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 1 Jun 2021 14:13:02 +0300 Subject: [PATCH 15/46] Looks like I got the images wrong. --- .appveyor.yml | 12 ++++++------ ci/templates/.appveyor.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6ee159e9..111eb3c5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,19 +17,19 @@ environment: - TOXENV: 'pypy3-pytest46-xdist127-coverage55,pypy3-pytest46-xdist133-coverage55,pypy3-pytest54-xdist133-coverage55,pypy3-pytest62-xdist202-coverage55' matrix: exclude: - - image: Visual Studio 2015 - TOXENV: 'py27-pytest46-xdist127-coverage55' - image: Visual Studio 2019 + TOXENV: 'py27-pytest46-xdist127-coverage55' + - image: Visual Studio 2015 TOXENV: 'py36-pytest46-xdist127-coverage55,py36-pytest46-xdist133-coverage55,py36-pytest54-xdist133-coverage55,py36-pytest62-xdist202-coverage55' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: 'py37-pytest46-xdist127-coverage55,py37-pytest46-xdist133-coverage55,py37-pytest54-xdist133-coverage55,py37-pytest62-xdist202-coverage55' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: 'py38-pytest46-xdist133-coverage55,py38-pytest54-xdist133-coverage55,py38-pytest62-xdist202-coverage55' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: 'py39-pytest62-xdist202-coverage55' - image: Visual Studio 2019 TOXENV: 'pypy-pytest46-xdist127-coverage55' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: 'pypy3-pytest46-xdist127-coverage55,pypy3-pytest46-xdist133-coverage55,pypy3-pytest54-xdist133-coverage55,pypy3-pytest62-xdist202-coverage55' init: - ps: echo $env:TOXENV diff --git a/ci/templates/.appveyor.yml b/ci/templates/.appveyor.yml index 01ca3493..6358a6d1 100644 --- a/ci/templates/.appveyor.yml +++ b/ci/templates/.appveyor.yml @@ -16,19 +16,19 @@ environment: - TOXENV: '{{ pypy3_environments|join(",") }}' matrix: exclude: - - image: Visual Studio 2015 - TOXENV: '{{ py27_environments|join(",") }}' - image: Visual Studio 2019 + TOXENV: '{{ py27_environments|join(",") }}' + - image: Visual Studio 2015 TOXENV: '{{ py36_environments|join(",") }}' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: '{{ py37_environments|join(",") }}' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: '{{ py38_environments|join(",") }}' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: '{{ py39_environments|join(",") }}' - image: Visual Studio 2019 TOXENV: '{{ pypy_environments|join(",") }}' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: '{{ pypy3_environments|join(",") }}' init: - ps: echo $env:TOXENV From 3685acbd61df9135e41b188374347d04d2d689db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 1 Jun 2021 14:45:47 +0300 Subject: [PATCH 16/46] Use 2019 image for pypy. --- .appveyor.yml | 2 +- ci/templates/.appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 111eb3c5..a0ffc795 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -27,7 +27,7 @@ matrix: TOXENV: 'py38-pytest46-xdist133-coverage55,py38-pytest54-xdist133-coverage55,py38-pytest62-xdist202-coverage55' - image: Visual Studio 2015 TOXENV: 'py39-pytest62-xdist202-coverage55' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: 'pypy-pytest46-xdist127-coverage55' - image: Visual Studio 2015 TOXENV: 'pypy3-pytest46-xdist127-coverage55,pypy3-pytest46-xdist133-coverage55,pypy3-pytest54-xdist133-coverage55,pypy3-pytest62-xdist202-coverage55' diff --git a/ci/templates/.appveyor.yml b/ci/templates/.appveyor.yml index 6358a6d1..2b7e611c 100644 --- a/ci/templates/.appveyor.yml +++ b/ci/templates/.appveyor.yml @@ -26,7 +26,7 @@ matrix: TOXENV: '{{ py38_environments|join(",") }}' - image: Visual Studio 2015 TOXENV: '{{ py39_environments|join(",") }}' - - image: Visual Studio 2019 + - image: Visual Studio 2015 TOXENV: '{{ pypy_environments|join(",") }}' - image: Visual Studio 2015 TOXENV: '{{ pypy3_environments|join(",") }}' From 67d49b9e06cbc1cace3fc2cdfe70b09f55d1726f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 1 Jun 2021 20:24:18 +0300 Subject: [PATCH 17/46] =?UTF-8?q?Bump=20version:=202.12.0=20=E2=86=92=202.?= =?UTF-8?q?12.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- README.rst | 4 ++-- docs/conf.py | 2 +- setup.py | 2 +- src/pytest_cov/__init__.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 7e15ff94..a838695a 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.12.0 +current_version = 2.12.1 commit = True tag = True diff --git a/README.rst b/README.rst index a0c44a71..149594fd 100644 --- a/README.rst +++ b/README.rst @@ -38,9 +38,9 @@ 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.12.0.svg +.. |commits-since| image:: https://img.shields.io/github/commits-since/pytest-dev/pytest-cov/v2.12.1.svg :alt: Commits since latest release - :target: https://github.com/pytest-dev/pytest-cov/compare/v2.12.0...master + :target: https://github.com/pytest-dev/pytest-cov/compare/v2.12.1...master .. |wheel| image:: https://img.shields.io/pypi/wheel/pytest-cov.svg :alt: PyPI Wheel diff --git a/docs/conf.py b/docs/conf.py index 1da75b8a..0668fdc2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ year = '2016' author = 'pytest-cov contributors' copyright = '{}, {}'.format(year, author) -version = release = '2.12.0' +version = release = '2.12.1' pygments_style = 'trac' templates_path = ['.'] diff --git a/setup.py b/setup.py index d3f9f133..143746ab 100755 --- a/setup.py +++ b/setup.py @@ -85,7 +85,7 @@ def run(self): setup( name='pytest-cov', - version='2.12.0', + version='2.12.1', license='MIT', description='Pytest plugin for measuring coverage.', long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), diff --git a/src/pytest_cov/__init__.py b/src/pytest_cov/__init__.py index a9f1cb62..dad3b766 100644 --- a/src/pytest_cov/__init__.py +++ b/src/pytest_cov/__init__.py @@ -1,2 +1,2 @@ """pytest-cov: avoid already-imported warning: PYTEST_DONT_REWRITE.""" -__version__ = '2.12.0' +__version__ = '2.12.1' From d5d06841f66d01105a65f7ceb7e1b404b9a28e1b Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 19 Jul 2021 21:15:48 +0300 Subject: [PATCH 18/46] Fix typo in contexts.rst (#478) The hyperlink wasn't rendering properly. This looks better. --- docs/contexts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contexts.rst b/docs/contexts.rst index c502c1d6..f651db5d 100644 --- a/docs/contexts.rst +++ b/docs/contexts.rst @@ -6,7 +6,7 @@ Coverage.py 5.0 can record separate coverage data for `different contexts`_ duri one run of a test suite. Pytest-cov can use this feature to record coverage data for each test individually, with the ``--cov-context=test`` option. -.. _`different_contexts`: https://coverage.readthedocs.io/en/stable/contexts.html +.. _different contexts: https://coverage.readthedocs.io/en/stable/contexts.html The context name recorded in the coverage.py database is the pytest test id, and the phase of execution, one of "setup", "run", or "teardown". These two From 2b6660ecd9ecea3a3d610bddde4915f4745a56a9 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Mon, 19 Jul 2021 19:19:43 +0100 Subject: [PATCH 19/46] Revert "Avoid using toml as extra (#472)" (#477) This reverts commit 34edfa1cf80f8d722dec4f587b10d2783f89a0f0. --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 143746ab..8cb1162b 100755 --- a/setup.py +++ b/setup.py @@ -124,8 +124,7 @@ def run(self): ], install_requires=[ 'pytest>=4.6', - 'coverage>=5.2.1', - 'toml' + 'coverage[toml]>=5.2.1' ], python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', extras_require={ From d810c6508ec0ae4de7131f3bafaa486cb53bbbf7 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Sun, 25 Jul 2021 13:20:36 +0100 Subject: [PATCH 20/46] warn specific classes (#361) * warn specific classes * Update src/pytest_cov/plugin.py * Update src/pytest_cov/compat.py * Update src/pytest_cov/compat.py * Update src/pytest_cov/compat.py * Update src/pytest_cov/plugin.py * Update src/pytest_cov/plugin.py --- src/pytest_cov/plugin.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index b875f409..f5a00953 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -14,6 +14,20 @@ class CoverageError(Exception): """Indicates that our coverage is too low""" +class PytestCovWarning(pytest.PytestWarning): + """ + The base for all pytest-cov warnings, never raised directly + """ + + +class CovDisabledWarning(PytestCovWarning): + """Indicates that Coverage was manually disabled""" + + +class CovReportWarning(PytestCovWarning): + """Indicates that we failed to generate a report""" + + def validate_report(arg): file_choices = ['annotate', 'html', 'xml'] term_choices = ['term', 'term-missing'] @@ -282,7 +296,7 @@ def pytest_runtestloop(self, session): message = 'Failed to generate report: %s\n' % exc session.config.pluginmanager.getplugin("terminalreporter").write( 'WARNING: %s\n' % message, red=True, bold=True) - warnings.warn(pytest.PytestWarning(message)) + warnings.warn(CovReportWarning(message)) self.cov_total = 0 assert self.cov_total is not None, 'Test coverage should never be `None`' if self._failed_cov_total(): @@ -294,7 +308,7 @@ def pytest_terminal_summary(self, terminalreporter): if self.options.no_cov_should_warn: message = 'Coverage disabled via --no-cov switch!' terminalreporter.write('WARNING: %s\n' % message, red=True, bold=True) - warnings.warn(pytest.PytestWarning(message)) + warnings.warn(CovDisabledWarning(message)) return if self.cov_controller is None: return From d976cded4eacdaba5b4099bec8949f4e94c40735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Wed, 28 Jul 2021 20:21:48 +0300 Subject: [PATCH 21/46] Improve argument validation a bit. --- src/pytest_cov/plugin.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index f5a00953..ffb87945 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -56,16 +56,23 @@ def validate_report(arg): def validate_fail_under(num_str): try: - return int(num_str) + value = int(num_str) except ValueError: - return float(num_str) + try: + value = float(num_str) + except ValueError: + raise argparse.ArgumentTypeError('An integer or float value is required.') + if value > 100: + raise argparse.ArgumentTypeError('Your desire for over-achievement is admirable but misplaced. ' + 'The maximum value is 100. Perhaps write more integration tests?') + return value def validate_context(arg): if coverage.version_info <= (5, 0): raise argparse.ArgumentTypeError('Contexts are only supported with coverage.py >= 5.x') if arg != "test": - raise argparse.ArgumentTypeError('--cov-context=test is the only supported value') + raise argparse.ArgumentTypeError('The only supported value is "test".') return arg From 88da65813635f1b85e0873d5d067de1dc1ce7332 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Sat, 14 Aug 2021 07:19:15 +0100 Subject: [PATCH 22/46] pre-commit autoupdate --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9942328..36701b79 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,16 +5,16 @@ exclude: '^(src/.*\.pth|\.tox|ci/templates|\.bumpversion\.cfg)(/|$)' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: master + rev: v4.0.1 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: debug-statements - repo: https://github.com/timothycrosley/isort - rev: master + rev: 5.9.3 hooks: - id: isort - repo: https://gitlab.com/pycqa/flake8 - rev: master + rev: 3.9.2 hooks: - id: flake8 From 9382ac5864362c02305ead9a58890f0daaa4f38d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 14 Aug 2021 06:19:34 +0000 Subject: [PATCH 23/46] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/config.rst | 10 +++++----- docs/contexts.rst | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index 0dfb17a0..38ff0c1b 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -23,13 +23,13 @@ For full details refer to the `coverage config file`_ documentation. .. note:: Important Note - This plugin overrides the ``data_file`` and ``parallel`` options of coverage. Unless you also run coverage without + 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) + + 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. diff --git a/docs/contexts.rst b/docs/contexts.rst index f651db5d..cde920d5 100644 --- a/docs/contexts.rst +++ b/docs/contexts.rst @@ -22,8 +22,8 @@ id, and each set of parameter values is recorded as a separate test. To view contexts when using ``--cov-report=html``, add this to your ``.coveragerc``:: [html] - show_contexts = True - + show_contexts = True + The HTML report will include an annotation on each covered line, indicating the -number of contexts that executed the line. Clicking the annotation displays a +number of contexts that executed the line. Clicking the annotation displays a list of the contexts. From 02e0e6045a8382ae678f51742939b88fc67a09b5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Aug 2021 18:46:23 +0000 Subject: [PATCH 24/46] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - https://github.com/timothycrosley/isort → https://github.com/PyCQA/isort - https://gitlab.com/pycqa/flake8 → https://github.com/PyCQA/flake8 --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36701b79..67d55a68 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,11 +10,11 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: debug-statements - - repo: https://github.com/timothycrosley/isort + - repo: https://github.com/PyCQA/isort rev: 5.9.3 hooks: - id: isort - - repo: https://gitlab.com/pycqa/flake8 + - repo: https://github.com/PyCQA/flake8 rev: 3.9.2 hooks: - id: flake8 From 5ab02e686a30afa5ac7c9d28829fddb9137f5e64 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 13 Aug 2021 13:40:17 +0100 Subject: [PATCH 25/46] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 67d55a68..98314202 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,3 +18,7 @@ repos: rev: 3.9.2 hooks: - id: flake8 + - repo: https://github.com/asottile/pyupgrade + rev: v2.23.3 + hooks: + - id: pyupgrade From 4a06aba59b50f3bdbe5e1fe3b23d3cab787c6823 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 13 Aug 2021 22:53:07 +0000 Subject: [PATCH 26/46] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ci/bootstrap.py | 8 ++++---- docs/conf.py | 2 +- examples/adhoc-layout/example/__init__.py | 1 - examples/src-layout/src/example/__init__.py | 1 - setup.py | 2 +- src/pytest_cov/engine.py | 4 ++-- tests/test_pytest_cov.py | 6 +++--- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ci/bootstrap.py b/ci/bootstrap.py index 61747a15..6e9e75f2 100755 --- a/ci/bootstrap.py +++ b/ci/bootstrap.py @@ -30,7 +30,7 @@ def exec_in_env(): if not exists(env_path): import subprocess - print("Making bootstrap env in: {0} ...".format(env_path)) + print("Making bootstrap env in: {} ...".format(env_path)) try: check_call([sys.executable, "-m", "venv", env_path]) except subprocess.CalledProcessError: @@ -44,7 +44,7 @@ def exec_in_env(): if not os.path.exists(python_executable): python_executable += '.exe' - print("Re-executing with: {0}".format(python_executable)) + print("Re-executing with: {}".format(python_executable)) print("+ exec", python_executable, __file__, "--no-env") os.execv(python_executable, [python_executable, __file__, "--no-env"]) @@ -52,7 +52,7 @@ def exec_in_env(): def main(): import jinja2 - print("Project path: {0}".format(base_path)) + print("Project path: {}".format(base_path)) jinja = jinja2.Environment( loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")), @@ -89,5 +89,5 @@ def main(): elif not args: exec_in_env() else: - print("Unexpected arguments {0}".format(args), file=sys.stderr) + print("Unexpected arguments {}".format(args), file=sys.stderr) sys.exit(1) diff --git a/docs/conf.py b/docs/conf.py index 0668fdc2..d3c31081 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,7 +47,7 @@ html_sidebars = { '**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'], } -html_short_title = '%s-%s' % (project, version) +html_short_title = '{}-{}'.format(project, version) napoleon_use_ivar = True napoleon_use_rtype = False diff --git a/examples/adhoc-layout/example/__init__.py b/examples/adhoc-layout/example/__init__.py index 18080ac5..8a6dfd5e 100644 --- a/examples/adhoc-layout/example/__init__.py +++ b/examples/adhoc-layout/example/__init__.py @@ -1,4 +1,3 @@ - import sys PY2 = sys.version_info[0] == 2 diff --git a/examples/src-layout/src/example/__init__.py b/examples/src-layout/src/example/__init__.py index 18080ac5..8a6dfd5e 100644 --- a/examples/src-layout/src/example/__init__.py +++ b/examples/src-layout/src/example/__init__.py @@ -1,4 +1,3 @@ - import sys PY2 = sys.version_info[0] == 2 diff --git a/setup.py b/setup.py index 8cb1162b..631573ea 100755 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def run(self): version='2.12.1', license='MIT', description='Pytest plugin for measuring coverage.', - long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), + long_description='{}\n{}'.format(read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), author='Marc Schlaich', author_email='marc.schlaich@gmail.com', url='https://github.com/pytest-dev/pytest-cov', diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 084e92ea..ccdc99f1 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -116,7 +116,7 @@ def unset_env(): def get_node_desc(platform, version_info): """Return a description of this node.""" - return 'platform %s, python %s' % (platform, '%s.%s.%s-%s-%s' % version_info[:5]) + return 'platform {}, python {}'.format(platform, '%s.%s.%s-%s-%s' % version_info[:5]) @staticmethod def sep(stream, s, txt): @@ -126,7 +126,7 @@ def sep(stream, s, txt): sep_total = max((70 - 2 - len(txt)), 2) sep_len = sep_total // 2 sep_extra = sep_total % 2 - out = '%s %s %s\n' % (s * sep_len, txt, s * (sep_len + sep_extra)) + out = '{} {} {}\n'.format(s * sep_len, txt, s * (sep_len + sep_extra)) stream.write(out) @_ensure_topdir diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 0d1b5a23..b4b9f534 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -780,13 +780,13 @@ def test_dist_not_collocated_coveragerc_source(testdir, prop): dir2 = testdir.mkdir('dir2') testdir.tmpdir.join('.coveragerc').write(''' [run] -%s -source = %s +{} +source = {} [paths] source = . dir1 - dir2''' % (prop.conf, script.dirpath())) + dir2'''.format(prop.conf, script.dirpath())) result = testdir.runpytest('-v', '--cov', From 3f9576caa68416a32e1b1458aa6a7e1f5b758663 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 13 Aug 2021 23:55:42 +0100 Subject: [PATCH 27/46] remove py2 compatibility syntax --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 98314202..e07f891b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,3 +22,4 @@ repos: rev: v2.23.3 hooks: - id: pyupgrade + args: [--py36-plus] From b3a41c38f9bb5678a7c0ff8939f781ddaa8c8b5d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 13 Aug 2021 22:55:49 +0000 Subject: [PATCH 28/46] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ci/bootstrap.py | 14 +++++--------- docs/conf.py | 7 ++----- setup.py | 5 +---- src/pytest_cov/compat.py | 2 +- src/pytest_cov/engine.py | 6 +++--- src/pytest_cov/plugin.py | 10 +++++----- tests/test_pytest_cov.py | 4 ++-- 7 files changed, 19 insertions(+), 29 deletions(-) diff --git a/ci/bootstrap.py b/ci/bootstrap.py index 6e9e75f2..77daad5b 100755 --- a/ci/bootstrap.py +++ b/ci/bootstrap.py @@ -1,8 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals import os import subprocess @@ -30,7 +26,7 @@ def exec_in_env(): if not exists(env_path): import subprocess - print("Making bootstrap env in: {} ...".format(env_path)) + print(f"Making bootstrap env in: {env_path} ...") try: check_call([sys.executable, "-m", "venv", env_path]) except subprocess.CalledProcessError: @@ -44,7 +40,7 @@ def exec_in_env(): if not os.path.exists(python_executable): python_executable += '.exe' - print("Re-executing with: {}".format(python_executable)) + print(f"Re-executing with: {python_executable}") print("+ exec", python_executable, __file__, "--no-env") os.execv(python_executable, [python_executable, __file__, "--no-env"]) @@ -52,7 +48,7 @@ def exec_in_env(): def main(): import jinja2 - print("Project path: {}".format(base_path)) + print(f"Project path: {base_path}") jinja = jinja2.Environment( loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")), @@ -78,7 +74,7 @@ def main(): with open(join(base_path, name), "w") as fh: fh.write('# NOTE: this file is auto-generated via ci/bootstrap.py (ci/templates/%s).\n' % name) fh.write(jinja.get_template(name).render(**template_vars)) - print("Wrote {}".format(name)) + print(f"Wrote {name}") print("DONE.") @@ -89,5 +85,5 @@ def main(): elif not args: exec_in_env() else: - print("Unexpected arguments {}".format(args), file=sys.stderr) + print(f"Unexpected arguments {args}", file=sys.stderr) sys.exit(1) diff --git a/docs/conf.py b/docs/conf.py index d3c31081..45da656c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import os import sphinx_py3doc_enhanced_theme @@ -25,7 +22,7 @@ project = 'pytest-cov' year = '2016' author = 'pytest-cov contributors' -copyright = '{}, {}'.format(year, author) +copyright = f'{year}, {author}' version = release = '2.12.1' pygments_style = 'trac' @@ -47,7 +44,7 @@ html_sidebars = { '**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'], } -html_short_title = '{}-{}'.format(project, version) +html_short_title = f'{project}-{version}' napoleon_use_ivar = True napoleon_use_rtype = False diff --git a/setup.py b/setup.py index 631573ea..0497db1d 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,4 @@ #!/usr/bin/env python -# -*- encoding: utf-8 -*- -from __future__ import absolute_import -from __future__ import print_function import io import re @@ -22,7 +19,7 @@ def read(*names, **kwargs): - with io.open( + with open( join(dirname(__file__), *names), encoding=kwargs.get('encoding', 'utf8') ) as fh: diff --git a/src/pytest_cov/compat.py b/src/pytest_cov/compat.py index 5b4a0bfb..f422f25c 100644 --- a/src/pytest_cov/compat.py +++ b/src/pytest_cov/compat.py @@ -14,7 +14,7 @@ hookwrapper = pytest.mark.hookwrapper -class SessionWrapper(object): +class SessionWrapper: def __init__(self, session): self._session = session if hasattr(session, 'testsfailed'): diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index ccdc99f1..0303c2f1 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -14,7 +14,7 @@ from .embed import cleanup -class _NullFile(object): +class _NullFile: @staticmethod def write(v): pass @@ -49,7 +49,7 @@ def ensure_topdir_wrapper(self, *args, **kwargs): return ensure_topdir_wrapper -class CovController(object): +class CovController: """Base class for different plugin implementations.""" def __init__(self, cov_source, cov_report, cov_config, cov_append, cov_branch, config=None, nodeid=None): @@ -126,7 +126,7 @@ def sep(stream, s, txt): sep_total = max((70 - 2 - len(txt)), 2) sep_len = sep_total // 2 sep_extra = sep_total % 2 - out = '{} {} {}\n'.format(s * sep_len, txt, s * (sep_len + sep_extra)) + out = f'{s * sep_len} {txt} {s * (sep_len + sep_extra)}\n' stream.write(out) @_ensure_topdir diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index f5a00953..e214627c 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -36,7 +36,7 @@ def validate_report(arg): values = arg.split(":", 1) report_type = values[0] if report_type not in all_choices + ['']: - msg = 'invalid choice: "{}" (choose from "{}")'.format(arg, all_choices) + msg = f'invalid choice: "{arg}" (choose from "{all_choices}")' raise argparse.ArgumentTypeError(msg) if len(values) == 1: @@ -141,7 +141,7 @@ def pytest_load_initial_conftests(early_config, parser, args): early_config.pluginmanager.register(plugin, '_cov') -class CovPlugin(object): +class CovPlugin: """Use coverage package to produce code coverage reports. Delegates all work to a particular implementation based on whether @@ -196,7 +196,7 @@ def start(self, controller_cls, config=None, nodeid=None): if config is None: # fake config option for engine - class Config(object): + class Config: option = self.options config = Config() @@ -354,7 +354,7 @@ def pytest_runtest_call(self, item): yield -class TestContextPlugin(object): +class TestContextPlugin: def __init__(self, cov): self.cov = cov @@ -368,7 +368,7 @@ def pytest_runtest_call(self, item): self.switch_context(item, 'run') def switch_context(self, item, when): - context = "{item.nodeid}|{when}".format(item=item, when=when) + context = f"{item.nodeid}|{when}" self.cov.switch_context(context) os.environ['COV_CORE_CONTEXT'] = context diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index b4b9f534..670bfcdd 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -1964,7 +1964,7 @@ def bad_init(): monkeypatch.setattr(embed, 'init', bad_init) monkeypatch.setattr(sys, 'stderr', buff) monkeypatch.setitem(os.environ, 'COV_CORE_SOURCE', 'foobar') - exec_(payload) + exec(payload) assert buff.getvalue() == '''pytest-cov: Failed to setup subprocess coverage. Environ: {'COV_CORE_SOURCE': 'foobar'} Exception: SpecificError() ''' @@ -2087,7 +2087,7 @@ def test_contexts(testdir, opts): continue data.set_query_context(context) actual = set(data.lines(test_context_path)) - assert line_data[label] == actual, "Wrong lines for context {!r}".format(context) + assert line_data[label] == actual, f"Wrong lines for context {context!r}" @pytest.mark.skipif("coverage.version_info >= (5, 0)") From ce732093f16ca43e0fb8d7075e666bf0960146df Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 13 Aug 2021 23:57:38 +0100 Subject: [PATCH 29/46] remove unused io import from setup.py --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 0497db1d..9508c16a 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import io import re from distutils.command.build import build from glob import glob From fadb280413fc1a73ad83443a692f6aae086c1696 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 13 Aug 2021 23:59:28 +0100 Subject: [PATCH 30/46] remove unused six import --- tests/test_pytest_cov.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 670bfcdd..233058fd 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -16,7 +16,6 @@ from process_tests import TestProcess as _TestProcess from process_tests import dump_on_error from process_tests import wait_for_strings -from six import exec_ import pytest_cov.plugin From f17d8c524125497a5359842788ad9946a292f4ab Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 18 Aug 2021 08:26:03 +0100 Subject: [PATCH 31/46] only exclude directories that need exluding --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e07f891b..dc36fa2b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,13 +2,13 @@ # pre-commit install # To update the pre-commit hooks run: # pre-commit install-hooks -exclude: '^(src/.*\.pth|\.tox|ci/templates|\.bumpversion\.cfg)(/|$)' repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.0.1 hooks: - id: trailing-whitespace - id: end-of-file-fixer + exclude: '.*\.pth$' - id: debug-statements - repo: https://github.com/PyCQA/isort rev: 5.9.3 From c9f11ed7278ca2dc0a68df2010203ad363408e69 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 18 Aug 2021 08:27:44 +0100 Subject: [PATCH 32/46] remove unusupported python versions from ci/tox --- .appveyor.yml | 8 -------- tox.ini | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a0ffc795..9f176ee5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,18 +7,13 @@ image: environment: matrix: - TOXENV: check - - TOXENV: 'py27-pytest46-xdist127-coverage55' - - TOXENV: 'py35-pytest46-xdist127-coverage55' - TOXENV: 'py36-pytest46-xdist127-coverage55,py36-pytest46-xdist133-coverage55,py36-pytest54-xdist133-coverage55,py36-pytest62-xdist202-coverage55' - TOXENV: 'py37-pytest46-xdist127-coverage55,py37-pytest46-xdist133-coverage55,py37-pytest54-xdist133-coverage55,py37-pytest62-xdist202-coverage55' - TOXENV: 'py38-pytest46-xdist133-coverage55,py38-pytest54-xdist133-coverage55,py38-pytest62-xdist202-coverage55' - TOXENV: 'py39-pytest62-xdist202-coverage55' - - TOXENV: 'pypy-pytest46-xdist127-coverage55' - TOXENV: 'pypy3-pytest46-xdist127-coverage55,pypy3-pytest46-xdist133-coverage55,pypy3-pytest54-xdist133-coverage55,pypy3-pytest62-xdist202-coverage55' matrix: exclude: - - image: Visual Studio 2019 - TOXENV: 'py27-pytest46-xdist127-coverage55' - image: Visual Studio 2015 TOXENV: 'py36-pytest46-xdist127-coverage55,py36-pytest46-xdist133-coverage55,py36-pytest54-xdist133-coverage55,py36-pytest62-xdist202-coverage55' - image: Visual Studio 2015 @@ -27,15 +22,12 @@ matrix: TOXENV: 'py38-pytest46-xdist133-coverage55,py38-pytest54-xdist133-coverage55,py38-pytest62-xdist202-coverage55' - image: Visual Studio 2015 TOXENV: 'py39-pytest62-xdist202-coverage55' - - image: Visual Studio 2015 - TOXENV: 'pypy-pytest46-xdist127-coverage55' - image: Visual Studio 2015 TOXENV: 'pypy3-pytest46-xdist127-coverage55,pypy3-pytest46-xdist133-coverage55,pypy3-pytest54-xdist133-coverage55,pypy3-pytest62-xdist202-coverage55' init: - ps: echo $env:TOXENV - ps: ls C:\Python* install: - - IF "%TOXENV:~0,5%" == "pypy-" choco install --no-progress python.pypy - IF "%TOXENV:~0,6%" == "pypy3-" choco install --no-progress pypy3 - SET PATH=C:\tools\pypy\pypy;%PATH% - C:\Python37\python -m pip install --progress-bar=off tox -rci/requirements.txt diff --git a/tox.ini b/tox.ini index 6be986e9..490a5201 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ passenv = [tox] envlist = check - py{27,35,36,37,py,py3}-pytest46-xdist127-coverage{55} + py{36,37,py,py3}-pytest46-xdist127-coverage{55} py{36,37,38,py3}-pytest{46,54}-xdist133-coverage{55} py{36,37,38,39,py3}-pytest{62}-xdist202-coverage{55} docs From 555fdcecc0da3d561b10a49a4b9333e4f8ec16b8 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 18 Aug 2021 12:57:16 +0100 Subject: [PATCH 33/46] update python_requires and trove classifiers --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 9508c16a..fa3e1a42 100755 --- a/setup.py +++ b/setup.py @@ -103,10 +103,8 @@ def run(self): 'Operating System :: POSIX', 'Operating System :: Unix', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', @@ -122,7 +120,7 @@ def run(self): 'pytest>=4.6', 'coverage[toml]>=5.2.1' ], - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', + python_requires='>=3.6', extras_require={ 'testing': [ 'fields', From 1f4277cd2733fa22702deb5aaca80db1a2747e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bielawski?= Date: Thu, 26 Aug 2021 15:17:47 +0100 Subject: [PATCH 34/46] Add Python 3.9 to trove classifiers (#481) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8cb1162b..d4e0c6de 100755 --- a/setup.py +++ b/setup.py @@ -110,10 +110,10 @@ def run(self): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Testing', From db5d7c9db1c12a93ba4e896c3cb15b77a65607de Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 20 Sep 2021 16:53:20 +0300 Subject: [PATCH 35/46] Replace Travis CI with GitHub Actions --- .github/workflows/examples.yml | 45 +++++++++++++++++ .github/workflows/lint.yml | 41 ++++++++++++++++ .github/workflows/test.yml | 68 ++++++++++++++++++++++++++ .travis.yml | 89 ---------------------------------- CONTRIBUTING.rst | 4 +- MANIFEST.in | 3 +- README.rst | 8 +-- ci/templates/.travis.yml | 61 ----------------------- docs/releasing.rst | 2 +- docs/reporting.rst | 2 +- 10 files changed, 164 insertions(+), 159 deletions(-) create mode 100644 .github/workflows/examples.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml delete mode 100644 ci/templates/.travis.yml diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 00000000..5835c173 --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,45 @@ +name: Examples + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + examples: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [ + "src-layout", + "adhoc-layout", + ] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: + examples-v1-${{ hashFiles('**/tox.ini') }} + restore-keys: | + examples-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + + - name: Examples + run: | + cd examples/${{ matrix.target }} + tox -v diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..001ccfee --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,41 @@ +name: Lint + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + toxenv: ["check", "docs"] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: + lint-v1-${{ hashFiles('**/tox.ini') }} + restore-keys: | + lint-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + + - name: Lint ${{ matrix.toxenv }} + run: | + tox -v -e ${{ matrix.toxenv }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..b11e9f02 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,68 @@ +name: Test + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["pypy3", "3.6", "3.7", "3.8", "3.9"] + tox-extra-versions: [ + "pytest46-xdist133-coverage55", + "pytest54-xdist133-coverage55", + "pytest62-xdist202-coverage55", + ] + include: + # Add new helper variables to existing jobs + - {python-version: "pypy3", tox-python-version: "pypy3"} + - {python-version: "3.6", tox-python-version: "py36"} + - {python-version: "3.7", tox-python-version: "py37"} + - {python-version: "3.8", tox-python-version: "py38"} + - {python-version: "3.9", tox-python-version: "py39"} + # Add extra jobs to the matrix + - {tox-extra-versions: "pytest46-xdist127", python-version: "pypy-2.7", tox-python-version: "pypy"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "pypy3", tox-python-version: "pypy3"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "2.7", tox-python-version: "py27"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.5", tox-python-version: "py35"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.6", tox-python-version: "py36"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.7", tox-python-version: "py37"} + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + test-${{ matrix.python-version }}-v1-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + test-${{ matrix.python-version }}-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + virtualenv --version + pip --version + tox --version + + - name: Tox tests + run: | + tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a9cafa4e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,89 +0,0 @@ -# NOTE: this file is auto-generated via ci/bootstrap.py (ci/templates/.travis.yml). -dist: xenial -language: python -cache: false -env: - global: - - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - - SEGFAULT_SIGNALS=all -stages: - - lint - - examples - - tests -jobs: - fast_finish: true - allow_failures: - - python: '3.8' - include: - - stage: lint - env: TOXENV=check - - env: TOXENV=docs - - - stage: tests - env: TOXENV=py27-pytest46-xdist127-coverage55 - python: '2.7' - - env: TOXENV=py35-pytest46-xdist127-coverage55 - python: '3.5' - - env: TOXENV=py36-pytest46-xdist127-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest46-xdist127-coverage55 - python: '3.7' - - env: TOXENV=pypy-pytest46-xdist127-coverage55 - python: 'pypy' - - env: TOXENV=pypy3-pytest46-xdist127-coverage55 - python: 'pypy3' - - env: TOXENV=py36-pytest46-xdist133-coverage55 - python: '3.6' - - env: TOXENV=py36-pytest54-xdist133-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest46-xdist133-coverage55 - python: '3.7' - - env: TOXENV=py37-pytest54-xdist133-coverage55 - python: '3.7' - - env: TOXENV=py38-pytest46-xdist133-coverage55 - python: '3.8' - - env: TOXENV=py38-pytest54-xdist133-coverage55 - python: '3.8' - - env: TOXENV=pypy3-pytest46-xdist133-coverage55 - python: 'pypy3' - - env: TOXENV=pypy3-pytest54-xdist133-coverage55 - python: 'pypy3' - - env: TOXENV=py36-pytest62-xdist202-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest62-xdist202-coverage55 - python: '3.7' - - env: TOXENV=py38-pytest62-xdist202-coverage55 - python: '3.8' - - env: TOXENV=py39-pytest62-xdist202-coverage55 - python: '3.9' - - env: TOXENV=pypy3-pytest62-xdist202-coverage55 - python: 'pypy3' - - - stage: examples - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/src-layout - - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/adhoc-layout -before_install: - - python --version - - uname -a - - lsb_release -a -install: - - python -mpip install --progress-bar=off tox -rci/requirements.txt - - virtualenv --version - - easy_install --version - - pip --version - - tox --version -script: - - tox -v -after_failure: - - more .tox/log/* | cat - - more .tox/*/log/* | cat -notifications: - email: - on_success: never - on_failure: always diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index f02562eb..e742be47 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -73,8 +73,8 @@ For merging, you should: 3. Add a note to ``CHANGELOG.rst`` about the changes. 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 `_ +.. [1] If you don't have all the necessary Python versions available locally you can rely on GitHub Actions - it will + `run the tests `_ for each change you add in the pull request. It will be slower though ... diff --git a/MANIFEST.in b/MANIFEST.in index 6db46114..af1581be 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,7 @@ prune examples/*/*/htmlcov prune examples/adhoc-layout/*.egg-info prune examples/src-layout/src/*.egg-info +graft .github/workflows graft src graft ci graft tests @@ -21,6 +22,6 @@ include CONTRIBUTING.rst include LICENSE include README.rst -include tox.ini .travis.yml .appveyor.yml .readthedocs.yml .pre-commit-config.yaml +include tox.ini .appveyor.yml .readthedocs.yml .pre-commit-config.yaml global-exclude *.py[cod] __pycache__/* *.so *.dylib .coverage .coverage.* diff --git a/README.rst b/README.rst index 149594fd..fa49179e 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Overview * - docs - |docs| * - tests - - | |travis| |appveyor| |requires| + - | |github-actions| |appveyor| |requires| * - package - | |version| |conda-forge| |wheel| |supported-versions| |supported-implementations| | |commits-since| @@ -19,9 +19,9 @@ Overview :target: https://readthedocs.org/projects/pytest-cov :alt: Documentation Status -.. |travis| image:: https://api.travis-ci.com/pytest-dev/pytest-cov.svg?branch=master - :alt: Travis-CI Build Status - :target: https://travis-ci.com/github/pytest-dev/pytest-cov +.. |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 .. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/pytest-dev/pytest-cov?branch=master&svg=true :alt: AppVeyor Build Status diff --git a/ci/templates/.travis.yml b/ci/templates/.travis.yml deleted file mode 100644 index 8c7e3b93..00000000 --- a/ci/templates/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -dist: xenial -language: python -cache: false -env: - global: - - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - - SEGFAULT_SIGNALS=all -stages: - - lint - - examples - - tests -jobs: - fast_finish: true - allow_failures: - - python: '3.8' - include: - - stage: lint - env: TOXENV=check - - env: TOXENV=docs - - - stage: tests -{% for env in tox_environments %} - {%+ if not loop.first %}- {% else %} {% endif -%} - env: TOXENV={{ env }} - {% if env.startswith("pypy-") %} - python: 'pypy' - {% elif env.startswith("pypy3-") %} - python: 'pypy3' - {% else %} - python: '{{ "{0[2]}.{0[3]}".format(env) }}' - {% endif -%} -{% endfor %} - - - stage: examples -{%- for example in ['src', 'adhoc'] %}{{ '' }} - {%+ if not loop.first %}- {% else %} {% endif -%} - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/{{ example }}-layout -{%- endfor %} - -before_install: - - python --version - - uname -a - - lsb_release -a -install: - - python -mpip install --progress-bar=off tox -rci/requirements.txt - - virtualenv --version - - easy_install --version - - pip --version - - tox --version -script: - - tox -v -after_failure: - - more .tox/log/* | cat - - more .tox/*/log/* | cat -notifications: - email: - on_success: never - on_failure: always diff --git a/docs/releasing.rst b/docs/releasing.rst index 245dca54..ae78228d 100644 --- a/docs/releasing.rst +++ b/docs/releasing.rst @@ -16,7 +16,7 @@ The process for releasing should follow these steps: git push git push --tags #. Wait for `AppVeyor `_ - and `Travis `_ to give the green builds. + and `GitHub Actions `_ to give the green builds. #. Check that the docs on `ReadTheDocs `_ are built. #. Make sure you have a clean checkout, run ``git status`` to verify. #. Manually clean temporary files (that are ignored and won't show up in ``git status``):: diff --git a/docs/reporting.rst b/docs/reporting.rst index e9e4b06b..eaa99ad3 100644 --- a/docs/reporting.rst +++ b/docs/reporting.rst @@ -71,4 +71,4 @@ The final report option can also suppress printing to the terminal:: This mode can be especially useful on continuous integration servers, where a coverage file is needed for subsequent processing, but no local report needs to be viewed. For example, -tests run on Travis-CI could produce a .coverage file for use with Coveralls. +tests run on GitHub Actions could produce a .coverage file for use with Coveralls. From 3490ccb725758abfbd1162abd53e8a6c454d1f95 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 20 Sep 2021 17:20:33 +0300 Subject: [PATCH 36/46] Python 2.7 and 3.5 support was already dropped --- .github/workflows/test.yml | 16 +++++----------- examples/adhoc-layout/example/__init__.py | 14 ++------------ examples/adhoc-layout/tox.ini | 6 +++--- examples/src-layout/src/example/__init__.py | 14 ++------------ examples/src-layout/tox.ini | 6 +++--- 5 files changed, 15 insertions(+), 41 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b11e9f02..272ade24 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,10 @@ jobs: matrix: python-version: ["pypy3", "3.6", "3.7", "3.8", "3.9"] tox-extra-versions: [ - "pytest46-xdist133-coverage55", - "pytest54-xdist133-coverage55", - "pytest62-xdist202-coverage55", + "pytest46-xdist127", + "pytest46-xdist133", + "pytest54-xdist133", + "pytest62-xdist202", ] include: # Add new helper variables to existing jobs @@ -24,13 +25,6 @@ jobs: - {python-version: "3.7", tox-python-version: "py37"} - {python-version: "3.8", tox-python-version: "py38"} - {python-version: "3.9", tox-python-version: "py39"} - # Add extra jobs to the matrix - - {tox-extra-versions: "pytest46-xdist127", python-version: "pypy-2.7", tox-python-version: "pypy"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "pypy3", tox-python-version: "pypy3"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "2.7", tox-python-version: "py27"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "3.5", tox-python-version: "py35"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "3.6", tox-python-version: "py36"} - - {tox-extra-versions: "pytest46-xdist127", python-version: "3.7", tox-python-version: "py37"} steps: - uses: actions/checkout@v2 @@ -65,4 +59,4 @@ jobs: - name: Tox tests run: | - tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }} + tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }}-coverage55 diff --git a/examples/adhoc-layout/example/__init__.py b/examples/adhoc-layout/example/__init__.py index 8a6dfd5e..4693ad3c 100644 --- a/examples/adhoc-layout/example/__init__.py +++ b/examples/adhoc-layout/example/__init__.py @@ -1,12 +1,2 @@ -import sys - -PY2 = sys.version_info[0] == 2 - - -if PY2: - def add(a, b): - return b + a - -else: - def add(a, b): - return a + b +def add(a, b): + return a + b diff --git a/examples/adhoc-layout/tox.ini b/examples/adhoc-layout/tox.ini index 6e299f24..7b6f7c43 100644 --- a/examples/adhoc-layout/tox.ini +++ b/examples/adhoc-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py38,report +envlist = py38,report [tool:pytest] addopts = @@ -7,7 +7,7 @@ addopts = [testenv] setenv = - py{27,38}: COVERAGE_FILE = .coverage.{envname} + py38: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov --cov-config={toxinidir}/.coveragerc {posargs:-vv} deps = pytest @@ -19,7 +19,7 @@ deps = ../.. depends = - report: py27,py38 + report: py38 # note that this is necessary to prevent the tests importing the code from your badly laid project changedir = tests diff --git a/examples/src-layout/src/example/__init__.py b/examples/src-layout/src/example/__init__.py index 8a6dfd5e..4693ad3c 100644 --- a/examples/src-layout/src/example/__init__.py +++ b/examples/src-layout/src/example/__init__.py @@ -1,12 +1,2 @@ -import sys - -PY2 = sys.version_info[0] == 2 - - -if PY2: - def add(a, b): - return b + a - -else: - def add(a, b): - return a + b +def add(a, b): + return a + b diff --git a/examples/src-layout/tox.ini b/examples/src-layout/tox.ini index 6be8e73d..5a2083c9 100644 --- a/examples/src-layout/tox.ini +++ b/examples/src-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py38,report +envlist = py38,report [tool:pytest] testpaths = tests @@ -8,7 +8,7 @@ addopts = [testenv] setenv = - py{27,38}: COVERAGE_FILE = .coverage.{envname} + py38: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov {posargs:-vv} deps = pytest @@ -20,7 +20,7 @@ deps = ../.. depends = - report: py27,py38 + report: py38 [testenv:report] skip_install = true From f81aa0c90c8f423248d8596179dfcbd8627a9a0f Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 20 Sep 2021 17:46:45 +0300 Subject: [PATCH 37/46] Remove some jobs from the matrix --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 272ade24..e09414f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,12 @@ jobs: - {python-version: "3.7", tox-python-version: "py37"} - {python-version: "3.8", tox-python-version: "py38"} - {python-version: "3.9", tox-python-version: "py39"} + exclude: + # Remove some jobs from the matrix + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.8"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.9"} + - {tox-extra-versions: "pytest46-xdist133", python-version: "3.9"} + - {tox-extra-versions: "pytest54-xdist133", python-version: "3.9"} steps: - uses: actions/checkout@v2 From b25afc71a15ff52f2edd1e8e78b85cb8390cbf60 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 20 Sep 2021 19:34:12 +0300 Subject: [PATCH 38/46] Hello world to demo GHA --- .github/workflows/test.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..b92a0fa3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: Test + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9"] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Hello world + run: | + echo "hello world" From a948e899fa002fbc7f52c6c0f7e7dffdf7987ec8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 21 Sep 2021 10:30:18 +0300 Subject: [PATCH 39/46] Test both PyPy3.6 and PyPy3.7 Co-authored-by: Thomas Grainger --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e09414f4..51a03bef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy3", "3.6", "3.7", "3.8", "3.9"] + python-version: ["pypy-3.6", "pypy-3.7", "3.6", "3.7", "3.8", "3.9"] tox-extra-versions: [ "pytest46-xdist127", "pytest46-xdist133", From f4a88d6187630295ce960010456def6b19ef01b2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 21 Sep 2021 10:34:07 +0300 Subject: [PATCH 40/46] Test both PyPy3.6 and PyPy3.7 --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51a03bef..967386af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,8 @@ jobs: ] include: # Add new helper variables to existing jobs - - {python-version: "pypy3", tox-python-version: "pypy3"} + - {python-version: "pypy-3.6", tox-python-version: "pypy3"} + - {python-version: "pypy-3.7", tox-python-version: "pypy3"} - {python-version: "3.6", tox-python-version: "py36"} - {python-version: "3.7", tox-python-version: "py37"} - {python-version: "3.8", tox-python-version: "py38"} From 6395ecec756433194c05d34af490315b35dddafa Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 21 Sep 2021 10:40:56 +0300 Subject: [PATCH 41/46] Test conditional collection on PyPy and CPython --- .github/workflows/examples.yml | 12 ++++++++---- examples/adhoc-layout/example/__init__.py | 13 +++++++++++-- examples/adhoc-layout/tox.ini | 6 +++--- examples/src-layout/src/example/__init__.py | 13 +++++++++++-- examples/src-layout/tox.ini | 6 +++--- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 5835c173..dbd62a6c 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -11,18 +11,22 @@ jobs: strategy: fail-fast: false matrix: + python-version: ["pypy-3.7", "3.9"] target: [ "src-layout", "adhoc-layout", ] - + include: + # Add new helper variables to existing jobs + - {python-version: "pypy-3.7", tox-python-version: "pypy3"} + - {python-version: "3.9", tox-python-version: "py39"} steps: - uses: actions/checkout@v2 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} - name: Cache uses: actions/cache@v2 @@ -42,4 +46,4 @@ jobs: - name: Examples run: | cd examples/${{ matrix.target }} - tox -v + tox -v -e ${{ matrix.tox-python-version }} diff --git a/examples/adhoc-layout/example/__init__.py b/examples/adhoc-layout/example/__init__.py index 4693ad3c..684905a1 100644 --- a/examples/adhoc-layout/example/__init__.py +++ b/examples/adhoc-layout/example/__init__.py @@ -1,2 +1,11 @@ -def add(a, b): - return a + b +import platform + +# test merging multiple tox runs with a platform +# based branch +if platform.python_implementation() == "PyPy": + def add(a, b): + return a + b + +else: + def add(a, b): + return a + b diff --git a/examples/adhoc-layout/tox.ini b/examples/adhoc-layout/tox.ini index 7b6f7c43..e855c315 100644 --- a/examples/adhoc-layout/tox.ini +++ b/examples/adhoc-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38,report +envlist = pypy3,py39,report [tool:pytest] addopts = @@ -7,7 +7,7 @@ addopts = [testenv] setenv = - py38: COVERAGE_FILE = .coverage.{envname} + py{py3,39}: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov --cov-config={toxinidir}/.coveragerc {posargs:-vv} deps = pytest @@ -19,7 +19,7 @@ deps = ../.. depends = - report: py38 + report: pypy3,py39 # note that this is necessary to prevent the tests importing the code from your badly laid project changedir = tests diff --git a/examples/src-layout/src/example/__init__.py b/examples/src-layout/src/example/__init__.py index 4693ad3c..684905a1 100644 --- a/examples/src-layout/src/example/__init__.py +++ b/examples/src-layout/src/example/__init__.py @@ -1,2 +1,11 @@ -def add(a, b): - return a + b +import platform + +# test merging multiple tox runs with a platform +# based branch +if platform.python_implementation() == "PyPy": + def add(a, b): + return a + b + +else: + def add(a, b): + return a + b diff --git a/examples/src-layout/tox.ini b/examples/src-layout/tox.ini index 5a2083c9..94b72730 100644 --- a/examples/src-layout/tox.ini +++ b/examples/src-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38,report +envlist = pypy3,py39,report [tool:pytest] testpaths = tests @@ -8,7 +8,7 @@ addopts = [testenv] setenv = - py38: COVERAGE_FILE = .coverage.{envname} + py{py3,39}: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov {posargs:-vv} deps = pytest @@ -20,7 +20,7 @@ deps = ../.. depends = - report: py38 + report: pypy3,py39 [testenv:report] skip_install = true From 96f9aad28a35d9d0824add0ef2309e600052c531 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 21 Sep 2021 10:53:55 +0300 Subject: [PATCH 42/46] Add 'all good' job to be added as a required build --- .github/workflows/test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 967386af..a60cbd96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,3 +67,11 @@ jobs: - name: Tox tests run: | tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }}-coverage55 + + allgood: + needs: test + runs-on: ubuntu-latest + name: Test successful + steps: + - name: Success + run: echo Test successful From 0bc997adfea8b6ab63029163044a2fc42fd7ecf1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 3 Oct 2021 21:22:32 +0300 Subject: [PATCH 43/46] Add support for Python 3.10 --- .github/workflows/test.yml | 6 +++++- setup.py | 1 + tox.ini | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a60cbd96..b9f7c11c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy-3.6", "pypy-3.7", "3.6", "3.7", "3.8", "3.9"] + python-version: ["pypy-3.6", "pypy-3.7", "3.6", "3.7", "3.8", "3.9", "3.10-dev"] tox-extra-versions: [ "pytest46-xdist127", "pytest46-xdist133", @@ -26,12 +26,16 @@ jobs: - {python-version: "3.7", tox-python-version: "py37"} - {python-version: "3.8", tox-python-version: "py38"} - {python-version: "3.9", tox-python-version: "py39"} + - {python-version: "3.10-dev", tox-python-version: "py310"} exclude: # Remove some jobs from the matrix - {tox-extra-versions: "pytest46-xdist127", python-version: "3.8"} - {tox-extra-versions: "pytest46-xdist127", python-version: "3.9"} - {tox-extra-versions: "pytest46-xdist133", python-version: "3.9"} - {tox-extra-versions: "pytest54-xdist133", python-version: "3.9"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.10-dev"} + - {tox-extra-versions: "pytest46-xdist133", python-version: "3.10-dev"} + - {tox-extra-versions: "pytest54-xdist133", python-version: "3.10-dev"} steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index 11e98a88..73370564 100755 --- a/setup.py +++ b/setup.py @@ -109,6 +109,7 @@ def run(self): 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Testing', diff --git a/tox.ini b/tox.ini index 490a5201..20a1561b 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ envlist = check py{36,37,py,py3}-pytest46-xdist127-coverage{55} py{36,37,38,py3}-pytest{46,54}-xdist133-coverage{55} - py{36,37,38,39,py3}-pytest{62}-xdist202-coverage{55} + py{36,37,38,39,310,py3}-pytest{62}-xdist202-coverage{55} docs [testenv] @@ -29,7 +29,7 @@ setenv = pytest54: _DEP_PYTEST=pytest==5.4.3 pytest60: _DEP_PYTEST=pytest==6.0.2 pytest61: _DEP_PYTEST=pytest==6.1.2 - pytest62: _DEP_PYTEST=pytest==6.2.2 + pytest62: _DEP_PYTEST=pytest==6.2.5 xdist127: _DEP_PYTESTXDIST=pytest-xdist==1.27.0 xdist129: _DEP_PYTESTXDIST=pytest-xdist==1.29.0 From 60a3cc1e796428f2373fb2024122f8dbc7f1c56b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 3 Oct 2021 21:24:03 +0300 Subject: [PATCH 44/46] No need to build universal wheels for Python 3-only --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index d6c36d12..360a416d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,3 @@ -[bdist_wheel] -universal = 1 - [flake8] max-line-length = 140 exclude = .tox,.eggs,ci/templates,build,dist From e988a6c48b45924433c9b38886f759f4f3be8a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 4 Oct 2021 03:07:53 +0300 Subject: [PATCH 45/46] Update changelog. --- AUTHORS.rst | 2 ++ CHANGELOG.rst | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 14cb7781..6aa916a1 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -48,3 +48,5 @@ Authors * Chris Sreesangkom - https://github.com/csreesan * Sorin Sbarnea - https://github.com/ssbarnea * Brian Rutledge - https://github.com/bhrutledge +* Danilo Šegan - https://github.com/dsegan +* Michał Bielawski - https://github.com/D3X diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ef5ad741..e6e47d95 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,41 @@ Changelog ========= + +3.0.0 (2021-10-04) +------------------- + +**Note that this release drops support for Python 2.7 and Python 3.5.** + +* Added support for Python 3.10 and updated various test dependencies. + Contributed by Hugo van Kemenade in + `#500 `_. +* Switched from Travis CI to GitHub Actions. Contributed by Hugo van Kemenade in + `#494 `_ and + `#495 `_. +* Add a ``--cov-reset`` CLI option. + Contributed by Danilo Šegan in + `#459 `_. +* Improved validation of ``--cov-fail-under`` CLI option. + Contributed by ... Ronny Pfannschmidt's desire for skark in + `#480 `_. +* Dropped Python 2.7 support. + Contributed by Thomas Grainger in + `#488 `_. +* Updated trove classifiers. Contributed by Michał Bielawski in + `#481 `_. + + +2.13.0 (2021-06-01) +------------------- + +* Changed the `toml` requirement to be always be directly required (instead of being required through a coverage extra). + This fixes issues with pip-compile (`pip-tools#1300 `_). + Contributed by Sorin Sbarnea in `#472 `_. +* Documented ``show_contexts``. + Contributed by Brian Rutledge in `#473 `_. + + 2.12.1 (2021-06-01) ------------------- From 560b95575efe9e55874bc8bbc99de1dd2db80ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 4 Oct 2021 04:48:36 +0300 Subject: [PATCH 46/46] =?UTF-8?q?Bump=20version:=202.12.1=20=E2=86=92=203.?= =?UTF-8?q?0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- README.rst | 4 ++-- docs/conf.py | 2 +- setup.py | 2 +- src/pytest_cov/__init__.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a838695a..27a843fb 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.12.1 +current_version = 3.0.0 commit = True tag = True diff --git a/README.rst b/README.rst index fa49179e..508aff84 100644 --- a/README.rst +++ b/README.rst @@ -38,9 +38,9 @@ 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.12.1.svg +.. |commits-since| image:: https://img.shields.io/github/commits-since/pytest-dev/pytest-cov/v3.0.0.svg :alt: Commits since latest release - :target: https://github.com/pytest-dev/pytest-cov/compare/v2.12.1...master + :target: https://github.com/pytest-dev/pytest-cov/compare/v3.0.0...master .. |wheel| image:: https://img.shields.io/pypi/wheel/pytest-cov.svg :alt: PyPI Wheel diff --git a/docs/conf.py b/docs/conf.py index 45da656c..5dd4e74b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,7 +23,7 @@ year = '2016' author = 'pytest-cov contributors' copyright = f'{year}, {author}' -version = release = '2.12.1' +version = release = '3.0.0' pygments_style = 'trac' templates_path = ['.'] diff --git a/setup.py b/setup.py index 73370564..503b9aac 100755 --- a/setup.py +++ b/setup.py @@ -81,7 +81,7 @@ def run(self): setup( name='pytest-cov', - version='2.12.1', + version='3.0.0', license='MIT', description='Pytest plugin for measuring coverage.', long_description='{}\n{}'.format(read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), diff --git a/src/pytest_cov/__init__.py b/src/pytest_cov/__init__.py index dad3b766..fba1d219 100644 --- a/src/pytest_cov/__init__.py +++ b/src/pytest_cov/__init__.py @@ -1,2 +1,2 @@ """pytest-cov: avoid already-imported warning: PYTEST_DONT_REWRITE.""" -__version__ = '2.12.1' +__version__ = '3.0.0'