From 00441a99282ad7ba2be9d7b983d6a28f49f0f14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 28 Oct 2017 03:45:28 +0300 Subject: [PATCH 01/22] Drop support for pytest<=2.8 and upgrade some test deps. --- .travis.yml | 152 +++++++++++++++++++-------------------- appveyor.yml | 10 +-- src/pytest_cov/plugin.py | 8 --- tox.ini | 13 ++-- 4 files changed, 89 insertions(+), 94 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1d6ed662..47afe5a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,18 +10,6 @@ env: - TOXENV=docs matrix: include: - - python: '2.6' - env: - - TOXENV=py26-28-40 - - python: '2.6' - env: - - TOXENV=py26-28-41 - - python: '2.6' - env: - - TOXENV=py26-28-42 - - python: '2.6' - env: - - TOXENV=py26-28-43 - python: '2.6' env: - TOXENV=py26-29-40 @@ -58,18 +46,18 @@ matrix: - python: '2.6' env: - TOXENV=py26-31-43 - - python: '2.7' + - python: '2.6' env: - - TOXENV=py27-28-40 - - python: '2.7' + - TOXENV=py26-32-40 + - python: '2.6' env: - - TOXENV=py27-28-41 - - python: '2.7' + - TOXENV=py26-32-41 + - python: '2.6' env: - - TOXENV=py27-28-42 - - python: '2.7' + - TOXENV=py26-32-42 + - python: '2.6' env: - - TOXENV=py27-28-43 + - TOXENV=py26-32-43 - python: '2.7' env: - TOXENV=py27-29-40 @@ -106,18 +94,18 @@ matrix: - python: '2.7' env: - TOXENV=py27-31-43 - - python: '3.3' + - python: '2.7' env: - - TOXENV=py33-28-40 - - python: '3.3' + - TOXENV=py27-32-40 + - python: '2.7' env: - - TOXENV=py33-28-41 - - python: '3.3' + - TOXENV=py27-32-41 + - python: '2.7' env: - - TOXENV=py33-28-42 - - python: '3.3' + - TOXENV=py27-32-42 + - python: '2.7' env: - - TOXENV=py33-28-43 + - TOXENV=py27-32-43 - python: '3.3' env: - TOXENV=py33-29-40 @@ -154,18 +142,18 @@ matrix: - python: '3.3' env: - TOXENV=py33-31-43 - - python: '3.4' + - python: '3.3' env: - - TOXENV=py34-28-40 - - python: '3.4' + - TOXENV=py33-32-40 + - python: '3.3' env: - - TOXENV=py34-28-41 - - python: '3.4' + - TOXENV=py33-32-41 + - python: '3.3' env: - - TOXENV=py34-28-42 - - python: '3.4' + - TOXENV=py33-32-42 + - python: '3.3' env: - - TOXENV=py34-28-43 + - TOXENV=py33-32-43 - python: '3.4' env: - TOXENV=py34-29-40 @@ -202,18 +190,18 @@ matrix: - python: '3.4' env: - TOXENV=py34-31-43 - - python: '3.5' + - python: '3.4' env: - - TOXENV=py35-28-40 - - python: '3.5' + - TOXENV=py34-32-40 + - python: '3.4' env: - - TOXENV=py35-28-41 - - python: '3.5' + - TOXENV=py34-32-41 + - python: '3.4' env: - - TOXENV=py35-28-42 - - python: '3.5' + - TOXENV=py34-32-42 + - python: '3.4' env: - - TOXENV=py35-28-43 + - TOXENV=py34-32-43 - python: '3.5' env: - TOXENV=py35-29-40 @@ -250,18 +238,18 @@ matrix: - python: '3.5' env: - TOXENV=py35-31-43 - - python: 'pypy-5.4' + - python: '3.5' env: - - TOXENV=pypy-28-40 - - python: 'pypy-5.4' + - TOXENV=py35-32-40 + - python: '3.5' env: - - TOXENV=pypy-28-41 - - python: 'pypy-5.4' + - TOXENV=py35-32-41 + - python: '3.5' env: - - TOXENV=pypy-28-42 - - python: 'pypy-5.4' + - TOXENV=py35-32-42 + - python: '3.5' env: - - TOXENV=pypy-28-43 + - TOXENV=py35-32-43 - python: 'pypy-5.4' env: - TOXENV=pypy-29-40 @@ -298,12 +286,18 @@ matrix: - python: 'pypy-5.4' env: - TOXENV=pypy-31-43 - - python: '2.7' + - python: 'pypy-5.4' env: - - TOXENV=py27-28-43 - - python: '2.7' + - TOXENV=pypy-32-40 + - python: 'pypy-5.4' + env: + - TOXENV=pypy-32-41 + - python: 'pypy-5.4' + env: + - TOXENV=pypy-32-42 + - python: 'pypy-5.4' env: - - TOXENV=py27-28-44 + - TOXENV=pypy-32-43 - python: '2.7' env: - TOXENV=py27-29-43 @@ -322,12 +316,12 @@ matrix: - python: '2.7' env: - TOXENV=py27-31-44 - - python: '3.3' + - python: '2.7' env: - - TOXENV=py33-28-43 - - python: '3.3' + - TOXENV=py27-32-43 + - python: '2.7' env: - - TOXENV=py33-28-44 + - TOXENV=py27-32-44 - python: '3.3' env: - TOXENV=py33-29-43 @@ -346,12 +340,12 @@ matrix: - python: '3.3' env: - TOXENV=py33-31-44 - - python: '3.4' + - python: '3.3' env: - - TOXENV=py34-28-43 - - python: '3.4' + - TOXENV=py33-32-43 + - python: '3.3' env: - - TOXENV=py34-28-44 + - TOXENV=py33-32-44 - python: '3.4' env: - TOXENV=py34-29-43 @@ -370,12 +364,12 @@ matrix: - python: '3.4' env: - TOXENV=py34-31-44 - - python: '3.5' + - python: '3.4' env: - - TOXENV=py35-28-43 - - python: '3.5' + - TOXENV=py34-32-43 + - python: '3.4' env: - - TOXENV=py35-28-44 + - TOXENV=py34-32-44 - python: '3.5' env: - TOXENV=py35-29-43 @@ -394,12 +388,12 @@ matrix: - python: '3.5' env: - TOXENV=py35-31-44 - - python: '3.6' + - python: '3.5' env: - - TOXENV=py36-28-43 - - python: '3.6' + - TOXENV=py35-32-43 + - python: '3.5' env: - - TOXENV=py36-28-44 + - TOXENV=py35-32-44 - python: '3.6' env: - TOXENV=py36-29-43 @@ -418,12 +412,12 @@ matrix: - python: '3.6' env: - TOXENV=py36-31-44 - - python: 'pypy-5.4' + - python: '3.6' env: - - TOXENV=pypy-28-43 - - python: 'pypy-5.4' + - TOXENV=py36-32-43 + - python: '3.6' env: - - TOXENV=pypy-28-44 + - TOXENV=py36-32-44 - python: 'pypy-5.4' env: - TOXENV=pypy-29-43 @@ -442,6 +436,12 @@ matrix: - python: 'pypy-5.4' env: - TOXENV=pypy-31-44 + - python: 'pypy-5.4' + env: + - TOXENV=pypy-32-43 + - python: 'pypy-5.4' + env: + - TOXENV=pypy-32-44 before_install: - python --version - uname -a diff --git a/appveyor.yml b/appveyor.yml index 89aa4da8..0c84b34a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,11 +5,11 @@ cache: environment: matrix: - TOXENV: check - - TOXENV: 'py26-28-40,py26-28-41,py26-28-42,py26-28-43,py26-29-40,py26-29-41,py26-29-42,py26-29-43,py26-30-40,py26-30-41,py26-30-42,py26-30-43,py26-31-40,py26-31-41,py26-31-42,py26-31-43' - - TOXENV: 'py27-28-40,py27-28-41,py27-28-42,py27-28-43,py27-29-40,py27-29-41,py27-29-42,py27-29-43,py27-30-40,py27-30-41,py27-30-42,py27-30-43,py27-31-40,py27-31-41,py27-31-42,py27-31-43,py27-28-43,py27-28-44,py27-29-43,py27-29-44,py27-30-43,py27-30-44,py27-31-43,py27-31-44' - - TOXENV: 'py34-28-40,py34-28-41,py34-28-42,py34-28-43,py34-29-40,py34-29-41,py34-29-42,py34-29-43,py34-30-40,py34-30-41,py34-30-42,py34-30-43,py34-31-40,py34-31-41,py34-31-42,py34-31-43,py34-28-43,py34-28-44,py34-29-43,py34-29-44,py34-30-43,py34-30-44,py34-31-43,py34-31-44' - - TOXENV: 'py35-28-40,py35-28-41,py35-28-42,py35-28-43,py35-29-40,py35-29-41,py35-29-42,py35-29-43,py35-30-40,py35-30-41,py35-30-42,py35-30-43,py35-31-40,py35-31-41,py35-31-42,py35-31-43,py35-28-43,py35-28-44,py35-29-43,py35-29-44,py35-30-43,py35-30-44,py35-31-43,py35-31-44' - - TOXENV: 'pypy-28-40,pypy-28-41,pypy-28-42,pypy-28-43,pypy-29-40,pypy-29-41,pypy-29-42,pypy-29-43,pypy-30-40,pypy-30-41,pypy-30-42,pypy-30-43,pypy-31-40,pypy-31-41,pypy-31-42,pypy-31-43,pypy-28-43,pypy-28-44,pypy-29-43,pypy-29-44,pypy-30-43,pypy-30-44,pypy-31-43,pypy-31-44' + - TOXENV: 'py26-29-40,py26-29-41,py26-29-42,py26-29-43,py26-30-40,py26-30-41,py26-30-42,py26-30-43,py26-31-40,py26-31-41,py26-31-42,py26-31-43,py26-32-40,py26-32-41,py26-32-42,py26-32-43' + - TOXENV: 'py27-29-40,py27-29-41,py27-29-42,py27-29-43,py27-30-40,py27-30-41,py27-30-42,py27-30-43,py27-31-40,py27-31-41,py27-31-42,py27-31-43,py27-32-40,py27-32-41,py27-32-42,py27-32-43,py27-29-43,py27-29-44,py27-30-43,py27-30-44,py27-31-43,py27-31-44,py27-32-43,py27-32-44' + - TOXENV: 'py34-29-40,py34-29-41,py34-29-42,py34-29-43,py34-30-40,py34-30-41,py34-30-42,py34-30-43,py34-31-40,py34-31-41,py34-31-42,py34-31-43,py34-32-40,py34-32-41,py34-32-42,py34-32-43,py34-29-43,py34-29-44,py34-30-43,py34-30-44,py34-31-43,py34-31-44,py34-32-43,py34-32-44' + - TOXENV: 'py35-29-40,py35-29-41,py35-29-42,py35-29-43,py35-30-40,py35-30-41,py35-30-42,py35-30-43,py35-31-40,py35-31-41,py35-31-42,py35-31-43,py35-32-40,py35-32-41,py35-32-42,py35-32-43,py35-29-43,py35-29-44,py35-30-43,py35-30-44,py35-31-43,py35-31-44,py35-32-43,py35-32-44' + - TOXENV: 'pypy-29-40,pypy-29-41,pypy-29-42,pypy-29-43,pypy-30-40,pypy-30-41,pypy-30-42,pypy-30-43,pypy-31-40,pypy-31-41,pypy-31-42,pypy-31-43,pypy-32-40,pypy-32-41,pypy-32-42,pypy-32-43,pypy-29-43,pypy-29-44,pypy-30-43,pypy-30-44,pypy-31-43,pypy-31-44,pypy-32-43,pypy-32-44' init: - ps: echo $env:TOXENV diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index 2ddf61ea..e03ec2a0 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -98,14 +98,6 @@ def pytest_load_initial_conftests(early_config, parser, args): early_config.pluginmanager.register(plugin, '_cov') -def pytest_configure(config): - """Activate coverage plugin if appropriate.""" - if config.getvalue('cov_source'): - if not config.pluginmanager.hasplugin('_cov'): - plugin = CovPlugin(config.option, config.pluginmanager, start=False) - config.pluginmanager.register(plugin, '_cov') - - class CovPlugin(object): """Use coverage package to produce code coverage reports. diff --git a/tox.ini b/tox.ini index 89fc9a1d..8395c939 100644 --- a/tox.ini +++ b/tox.ini @@ -3,8 +3,8 @@ [tox] envlist = check, - {py26,py27,py33,py34,py35,pypy}-{28,29,30,31}-{40,41,42,43}, - {py27,py33,py34,py35,py36,pypy}-{28,29,30,31}-{43,44}, + {py26,py27,py33,py34,py35,pypy}-{29,30,31,32}-{40,41,42,43}, + {py27,py33,py34,py35,py36,pypy}-{29,30,31,32}-{43,44}, docs [testenv] @@ -30,10 +30,13 @@ deps = 29: pytest-xdist==1.17.1 30: pytest==3.0.7 - 30: pytest-xdist==1.18.2 + 30: pytest-xdist==1.20.1 31: pytest==3.1.3 - 31: pytest-xdist==1.18.2 + 31: pytest-xdist==1.20.1 + + 32: pytest==3.2.3 + 32: pytest-xdist==1.20.1 37: coverage==3.7.1 40: coverage==4.0.3 @@ -43,7 +46,7 @@ deps = 44: coverage==4.4.1 virtualenv - process-tests==1.2.1 + process-tests==1.2.2 six fields pip_pre = true From 6b1e878f3654d3758bd7f3fefcc90b0b828d158e Mon Sep 17 00:00:00 2001 From: Ryan Hiebert Date: Sun, 1 Jan 2017 23:27:09 -0600 Subject: [PATCH 02/22] New coverage instance to combine --- src/pytest_cov/engine.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 6fd22908..483484f7 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -152,8 +152,16 @@ def finish(self): self.unset_env() self.cov.stop() + self.cov.save() + + # Create a new coverage instance to combine the files. + # Replace the old instance with the new one so that it is + # used for reporting. + self.cov = coverage.coverage(source=self.cov_source, + config_file=self.cov_config) self.cov.combine() self.cov.save() + node_desc = self.get_node_desc(sys.platform, sys.version_info) self.node_descs.add(node_desc) From bdfd9c3907f66430fd8d9e9569ae4c3d214a8b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 3 Jan 2017 23:56:47 +0200 Subject: [PATCH 03/22] Load data again before combine. --- src/pytest_cov/engine.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 483484f7..a0d8e6be 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -144,6 +144,7 @@ def start(self): self.cov.load() else: self.cov.erase() + self.data_file = os.path.abspath(self.cov.config.data_file) self.cov.start() self.set_env() @@ -158,7 +159,9 @@ def finish(self): # Replace the old instance with the new one so that it is # used for reporting. self.cov = coverage.coverage(source=self.cov_source, + data_file=self.data_file, config_file=self.cov_config) + self.cov.load() self.cov.combine() self.cov.save() @@ -236,6 +239,14 @@ def finish(self): # Combine all the suffix files into the data file. self.cov.stop() + + # Create a new coverage instance to combine the files. + # Replace the old instance with the new one so that it is + # used for reporting. + self.cov = coverage.coverage(source=self.cov_source, + data_file=self.data_file, + config_file=self.cov_config) + self.cov.load() self.cov.combine() self.cov.save() From 58c3ef15075a24077a2395b0edf0a6952c956d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 3 Jan 2017 23:58:21 +0200 Subject: [PATCH 04/22] Make sure config path is absulutized early. Fixes failures in finish (where now we reinitialize the cov object for forced combine) that are caused by sloppy cwd changes (crazy stuff ppl put in tests). --- src/pytest_cov/engine.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index a0d8e6be..535b480b 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -18,7 +18,7 @@ def __init__(self, cov_source, cov_report, cov_config, cov_append, cov_branch, c """Get some common config used by multiple derived classes.""" self.cov_source = cov_source self.cov_report = cov_report - self.cov_config = cov_config + self.cov_config = os.path.abspath(cov_config) self.cov_append = cov_append self.cov_branch = cov_branch self.config = config @@ -35,9 +35,8 @@ def set_env(self): os.environ['COV_CORE_SOURCE'] = os.pathsep else: os.environ['COV_CORE_SOURCE'] = os.pathsep.join(self.cov_source) - config_file = os.path.abspath(self.cov_config) - if os.path.exists(config_file): - os.environ['COV_CORE_CONFIG'] = config_file + if os.path.exists(self.cov_config): + os.environ['COV_CORE_CONFIG'] = self.cov_config else: os.environ['COV_CORE_CONFIG'] = os.pathsep os.environ['COV_CORE_DATAFILE'] = os.path.abspath(self.cov.config.data_file) From d6ef668f2e6a76fbc29883567a0a28067661b136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 3 Jan 2017 23:58:46 +0200 Subject: [PATCH 05/22] Add a test for aliasing (the combine in finish changes). --- tests/test_pytest_cov.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index e056bb0d..ed1e1b63 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -400,6 +400,42 @@ def test_central_coveragerc(testdir, prop): assert result.ret == 0 +def test_central_with_path_aliasing(testdir, monkeypatch, prop): + mod1 = testdir.mkdir('src').join('mod.py') + mod1.write(SCRIPT) + mod2 = testdir.mkdir('aliased').join('mod.py') + mod2.write(SCRIPT) + script = testdir.makepyfile(''' +from mod import * +''') + testdir.tmpdir.join('.coveragerc').write(""" +[paths] +source = + src + aliased +[run] +source = mod +parallel = true +""") + + monkeypatch.setitem(os.environ, 'PYTHONPATH', os.pathsep.join([os.environ.get('PYTHONPATH',''), 'aliased'])) + result = testdir.runpytest('-v', + '--cov', + '--cov-report=term-missing', + script) + + result.stdout.fnmatch_lines([ + '*- coverage: platform *, python * -*', + '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 + + def test_show_missing_coveragerc(testdir, prop): script = testdir.makepyfile(prop.code) testdir.tmpdir.join('.coveragerc').write(""" From c463fd7e1a891d6c2b434d21407f79ee7c721e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 3 Jan 2017 23:59:04 +0200 Subject: [PATCH 06/22] Seem this becomes absolute path, just let it be. --- tests/test_pytest_cov.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index ed1e1b63..eb9ab391 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -617,8 +617,8 @@ def test_central_subprocess_change_cwd(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'child_script* %s*' % CHILD_SCRIPT_RESULT, - 'parent_script* 100%*', + '*child_script* %s*' % CHILD_SCRIPT_RESULT, + '*parent_script* 100%*', ]) assert result.ret == 0 From d833b1edcb43713086b9b9514ac30306d567c9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Wed, 4 Jan 2017 00:20:14 +0200 Subject: [PATCH 07/22] Add tests for xdist and suprocess and fix handling in xdist mode (missing data_file attr). --- src/pytest_cov/engine.py | 2 ++ tests/test_pytest_cov.py | 49 +++++++++++++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 535b480b..46aa04d6 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -25,6 +25,7 @@ def __init__(self, cov_source, cov_report, cov_config, cov_append, cov_branch, c self.nodeid = nodeid self.cov = None + self.data_file = None self.node_descs = set() self.failed_slaves = [] self.topdir = os.getcwd() @@ -184,6 +185,7 @@ def start(self): self.cov.load() else: self.cov.erase() + self.data_file = os.path.abspath(self.cov.config.data_file) self.cov.start() self.cov.config.paths['source'] = [self.topdir] diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index eb9ab391..56e03d64 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -65,6 +65,7 @@ def test_bar(): ''' SCRIPT_PARENT = ''' +import os import subprocess import sys @@ -74,7 +75,7 @@ def pytest_generate_tests(metafunc): def test_foo(idx): out, err = subprocess.Popen( - [sys.executable, 'child_script.py', str(idx)], + [sys.executable, os.path.join(os.path.dirname(__file__), 'child_script.py'), str(idx)], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() @@ -149,7 +150,7 @@ def test_fail(): ''' CHILD_SCRIPT_RESULT = '[56] * 100%' -PARENT_SCRIPT_RESULT = '8 * 100%' +PARENT_SCRIPT_RESULT = '9 * 100%' DEST_DIR = 'cov_dest' REPORT_NAME = 'cov.xml' @@ -400,7 +401,8 @@ def test_central_coveragerc(testdir, prop): assert result.ret == 0 -def test_central_with_path_aliasing(testdir, monkeypatch, prop): +@xdist +def test_central_with_path_aliasing(testdir, monkeypatch, opts, prop): mod1 = testdir.mkdir('src').join('mod.py') mod1.write(SCRIPT) mod2 = testdir.mkdir('aliased').join('mod.py') @@ -422,11 +424,11 @@ def test_central_with_path_aliasing(testdir, monkeypatch, prop): result = testdir.runpytest('-v', '--cov', '--cov-report=term-missing', - script) + script, *opts.split()) result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'src/mod* %s *' % prop.result, + 'src[\\/]mod* %s *' % prop.result, '*10 passed*', ]) @@ -434,7 +436,42 @@ def test_central_with_path_aliasing(testdir, monkeypatch, prop): assert all(not line.startswith('TOTAL ') for line in result.stdout.lines[-4:]) assert result.ret == 0 - + + +def test_subprocess_with_path_aliasing(testdir, monkeypatch): + src = testdir.mkdir('src') + src.join('parent_script.py').write(SCRIPT_PARENT) + src.join('child_script.py').write(SCRIPT_CHILD) + aliased = testdir.mkdir('aliased') + parent_script = aliased.join('parent_script.py') + parent_script.write(SCRIPT_PARENT) + aliased.join('child_script.py').write(SCRIPT_CHILD) + + testdir.tmpdir.join('.coveragerc').write(""" +[paths] +source = + src + aliased +[run] +source = + parent_script + child_script +parallel = true +""") + + monkeypatch.setitem(os.environ, 'PYTHONPATH', os.pathsep.join([os.environ.get('PYTHONPATH',''), 'aliased'])) + result = testdir.runpytest('-v', + '--cov', + '--cov-report=term-missing', + parent_script) + + result.stdout.fnmatch_lines([ + '*- coverage: platform *, python * -*', + 'src[\\/]child_script* %s*' % CHILD_SCRIPT_RESULT, + 'src[\\/]parent_script* %s*' % PARENT_SCRIPT_RESULT, + ]) + assert result.ret == 0 + def test_show_missing_coveragerc(testdir, prop): script = testdir.makepyfile(prop.code) From 5735d9b34470508b0656d55d7c267fec2b3dbad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Wed, 4 Jan 2017 02:14:30 +0200 Subject: [PATCH 08/22] Check if it's a path first (don't absolutize None). --- src/pytest_cov/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 46aa04d6..25f73220 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -18,7 +18,7 @@ def __init__(self, cov_source, cov_report, cov_config, cov_append, cov_branch, c """Get some common config used by multiple derived classes.""" self.cov_source = cov_source self.cov_report = cov_report - self.cov_config = os.path.abspath(cov_config) + self.cov_config = os.path.abspath(cov_config) if os.path.exists(cov_config) else cov_config self.cov_append = cov_append self.cov_branch = cov_branch self.config = config From 384524558230d2eb08285ee0e877e522d981f6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Wed, 4 Jan 2017 03:17:44 +0200 Subject: [PATCH 09/22] Create a duplicated (ish) cov object for combining as @ryanhiebert suggests. This reverts commit 6e097e22280fd11caef45ec1f29e60026a5aaa34 and b55f56dcbe0a894c7ab587629792ba3c83ad04f4. --- src/pytest_cov/engine.py | 26 +++++++++----------------- tests/test_pytest_cov.py | 8 ++++---- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 25f73220..62ad243b 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -25,6 +25,7 @@ def __init__(self, cov_source, cov_report, cov_config, cov_append, cov_branch, c self.nodeid = nodeid self.cov = None + self.combining_cov = None self.data_file = None self.node_descs = set() self.failed_slaves = [] @@ -136,15 +137,16 @@ class Central(CovController): def start(self): """Erase any previous coverage data and start coverage.""" - self.cov = coverage.coverage(source=self.cov_source, branch=self.cov_branch, config_file=self.cov_config) + self.combining_cov = coverage.coverage(source=self.cov_source, + data_file=os.path.abspath(self.cov.config.data_file), + config_file=self.cov_config) if self.cov_append: self.cov.load() else: self.cov.erase() - self.data_file = os.path.abspath(self.cov.config.data_file) self.cov.start() self.set_env() @@ -154,13 +156,6 @@ def finish(self): self.unset_env() self.cov.stop() self.cov.save() - - # Create a new coverage instance to combine the files. - # Replace the old instance with the new one so that it is - # used for reporting. - self.cov = coverage.coverage(source=self.cov_source, - data_file=self.data_file, - config_file=self.cov_config) self.cov.load() self.cov.combine() self.cov.save() @@ -181,11 +176,13 @@ def start(self): self.cov = coverage.coverage(source=self.cov_source, branch=self.cov_branch, config_file=self.cov_config) + self.combining_cov = coverage.coverage(source=self.cov_source, + data_file=os.path.abspath(self.cov.config.data_file), + config_file=self.cov_config) if self.cov_append: self.cov.load() else: self.cov.erase() - self.data_file = os.path.abspath(self.cov.config.data_file) self.cov.start() self.cov.config.paths['source'] = [self.topdir] @@ -240,13 +237,8 @@ def finish(self): # Combine all the suffix files into the data file. self.cov.stop() - - # Create a new coverage instance to combine the files. - # Replace the old instance with the new one so that it is - # used for reporting. - self.cov = coverage.coverage(source=self.cov_source, - data_file=self.data_file, - config_file=self.cov_config) + self.cov.save() + self.cov = self.combining_cov self.cov.load() self.cov.combine() self.cov.save() diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 56e03d64..f38b529b 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -410,18 +410,18 @@ def test_central_with_path_aliasing(testdir, monkeypatch, opts, prop): script = testdir.makepyfile(''' from mod import * ''') - testdir.tmpdir.join('.coveragerc').write(""" -[paths] + testdir.tmpdir.join('setup.cfg').write(""" +[coverage:paths] source = src aliased -[run] +[coverage:run] source = mod parallel = true """) monkeypatch.setitem(os.environ, 'PYTHONPATH', os.pathsep.join([os.environ.get('PYTHONPATH',''), 'aliased'])) - result = testdir.runpytest('-v', + result = testdir.runpytest('-v', '-s', '--cov', '--cov-report=term-missing', script, *opts.split()) From 194266cd1fa95ee3a75816c7e8047fbc9cf0a241 Mon Sep 17 00:00:00 2001 From: Ryan Hiebert Date: Tue, 3 Jan 2017 21:53:18 -0600 Subject: [PATCH 10/22] Override cov with combining_cov --- src/pytest_cov/engine.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 62ad243b..ef606ee4 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -156,6 +156,8 @@ def finish(self): self.unset_env() self.cov.stop() self.cov.save() + + self.cov = self.combining_cov self.cov.load() self.cov.combine() self.cov.save() From 7438666130030dded3e0894857684babe905aa84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 28 Oct 2017 05:54:48 +0300 Subject: [PATCH 11/22] Correct tests (missing arguments). --- tests/test_pytest_cov.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index f38b529b..cc9a74a8 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -418,13 +418,14 @@ def test_central_with_path_aliasing(testdir, monkeypatch, opts, prop): [coverage:run] source = mod parallel = true -""") +%s +""" % prop.conf) - monkeypatch.setitem(os.environ, 'PYTHONPATH', os.pathsep.join([os.environ.get('PYTHONPATH',''), 'aliased'])) + monkeypatch.setitem(os.environ, 'PYTHONPATH', os.pathsep.join([os.environ.get('PYTHONPATH', ''), 'aliased'])) result = testdir.runpytest('-v', '-s', '--cov', '--cov-report=term-missing', - script, *opts.split()) + script, *opts.split()+prop.args) result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', From ea895d2f86e6a495d927fec9c2468034dd051697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 28 Oct 2017 05:55:14 +0300 Subject: [PATCH 12/22] Use aliasing for non-colocation test. --- tests/test_pytest_cov.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index cc9a74a8..befe6477 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -169,6 +169,7 @@ def prop(request): code2=SCRIPT2, conf=request.param[0], fullconf='[run]\n%s\n' % request.param[0], + prefixedfullconf='[coverage:run]\n%s\n' % request.param[0], args=request.param[1].split(), result=request.param[2], result2=request.param[3], @@ -598,7 +599,14 @@ def test_dist_not_collocated(testdir, prop): script = testdir.makepyfile(prop.code) dir1 = testdir.mkdir('dir1') dir2 = testdir.mkdir('dir2') - testdir.tmpdir.join('.coveragerc').write(prop.fullconf) + testdir.tmpdir.join('.coveragerc').write(''' +[run] +%s +[paths] +source = + . + dir1 + dir2''' % prop.conf) result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), From 2cfbaa81c88fa407eedafa38d4c8e8d96cd895cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 28 Oct 2017 05:55:35 +0300 Subject: [PATCH 13/22] Add missing branch option. --- src/pytest_cov/engine.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index ef606ee4..1045cef2 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -141,6 +141,7 @@ def start(self): branch=self.cov_branch, config_file=self.cov_config) self.combining_cov = coverage.coverage(source=self.cov_source, + branch=self.cov_branch, data_file=os.path.abspath(self.cov.config.data_file), config_file=self.cov_config) if self.cov_append: @@ -179,6 +180,7 @@ def start(self): branch=self.cov_branch, config_file=self.cov_config) self.combining_cov = coverage.coverage(source=self.cov_source, + branch=self.cov_branch, data_file=os.path.abspath(self.cov.config.data_file), config_file=self.cov_config) if self.cov_append: From 1da96c2317c30acedf4069eee40f2258c40442e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 28 Oct 2017 06:44:04 +0300 Subject: [PATCH 14/22] Undo these changes. --- src/pytest_cov/engine.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 1045cef2..b76873dd 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -18,7 +18,7 @@ def __init__(self, cov_source, cov_report, cov_config, cov_append, cov_branch, c """Get some common config used by multiple derived classes.""" self.cov_source = cov_source self.cov_report = cov_report - self.cov_config = os.path.abspath(cov_config) if os.path.exists(cov_config) else cov_config + self.cov_config = cov_config self.cov_append = cov_append self.cov_branch = cov_branch self.config = config @@ -37,8 +37,9 @@ def set_env(self): os.environ['COV_CORE_SOURCE'] = os.pathsep else: os.environ['COV_CORE_SOURCE'] = os.pathsep.join(self.cov_source) - if os.path.exists(self.cov_config): - os.environ['COV_CORE_CONFIG'] = self.cov_config + config_file = os.path.abspath(self.cov_config) + if os.path.exists(config_file): + os.environ['COV_CORE_CONFIG'] = config_file else: os.environ['COV_CORE_CONFIG'] = os.pathsep os.environ['COV_CORE_DATAFILE'] = os.path.abspath(self.cov.config.data_file) From 8eae2242df3ea8471187587e81ee97de3f65b7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 28 Oct 2017 06:44:47 +0300 Subject: [PATCH 15/22] Add a coveragerc with path configuration. --- tests/test_pytest_cov.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index befe6477..b0de17e6 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -748,15 +748,21 @@ def test_dist_subprocess_not_collocated(testdir, tmpdir): dir1 = tmpdir.mkdir('dir1') dir2 = tmpdir.mkdir('dir2') - + testdir.tmpdir.join('.coveragerc').write(''' +[paths] +source = + %s + */dir1 + */dir2 +''' % scripts.dirpath()) result = testdir.runpytest('-v', '--cov=%s' % scripts.dirpath(), - '--cov-report=term-missing', '--dist=load', '--tx=popen//chdir=%s' % dir1, '--tx=popen//chdir=%s' % dir2, '--rsyncdir=%s' % child_script, '--rsyncdir=%s' % parent_script, + '--rsyncdir=.coveragerc', '--max-slave-restart=0', parent_script) From 0d75fd2c5f9f39f0f7eadb626a75a728a2c6dc2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 28 Oct 2017 06:44:59 +0300 Subject: [PATCH 16/22] Some debugging. --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 8395c939..797c3081 100644 --- a/tox.ini +++ b/tox.ini @@ -46,6 +46,7 @@ deps = 44: coverage==4.4.1 virtualenv + hunter process-tests==1.2.2 six fields From 3f2ea3fc6d53551cea58e0c1b4721c9e713d2f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 28 Oct 2017 15:28:58 +0300 Subject: [PATCH 17/22] Drop support for py2.6, pytest<=2.8 and coverage<4.0. --- .travis.yml | 48 --------------------------------------- appveyor.yml | 1 - ci/templates/appveyor.yml | 1 - setup.py | 5 ++-- tox.ini | 13 ++--------- 5 files changed, 4 insertions(+), 64 deletions(-) diff --git a/.travis.yml b/.travis.yml index 47afe5a0..d3b79792 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,54 +10,6 @@ env: - TOXENV=docs matrix: include: - - python: '2.6' - env: - - TOXENV=py26-29-40 - - python: '2.6' - env: - - TOXENV=py26-29-41 - - python: '2.6' - env: - - TOXENV=py26-29-42 - - python: '2.6' - env: - - TOXENV=py26-29-43 - - python: '2.6' - env: - - TOXENV=py26-30-40 - - python: '2.6' - env: - - TOXENV=py26-30-41 - - python: '2.6' - env: - - TOXENV=py26-30-42 - - python: '2.6' - env: - - TOXENV=py26-30-43 - - python: '2.6' - env: - - TOXENV=py26-31-40 - - python: '2.6' - env: - - TOXENV=py26-31-41 - - python: '2.6' - env: - - TOXENV=py26-31-42 - - python: '2.6' - env: - - TOXENV=py26-31-43 - - python: '2.6' - env: - - TOXENV=py26-32-40 - - python: '2.6' - env: - - TOXENV=py26-32-41 - - python: '2.6' - env: - - TOXENV=py26-32-42 - - python: '2.6' - env: - - TOXENV=py26-32-43 - python: '2.7' env: - TOXENV=py27-29-40 diff --git a/appveyor.yml b/appveyor.yml index 0c84b34a..6574ac9c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,6 @@ cache: environment: matrix: - TOXENV: check - - TOXENV: 'py26-29-40,py26-29-41,py26-29-42,py26-29-43,py26-30-40,py26-30-41,py26-30-42,py26-30-43,py26-31-40,py26-31-41,py26-31-42,py26-31-43,py26-32-40,py26-32-41,py26-32-42,py26-32-43' - TOXENV: 'py27-29-40,py27-29-41,py27-29-42,py27-29-43,py27-30-40,py27-30-41,py27-30-42,py27-30-43,py27-31-40,py27-31-41,py27-31-42,py27-31-43,py27-32-40,py27-32-41,py27-32-42,py27-32-43,py27-29-43,py27-29-44,py27-30-43,py27-30-44,py27-31-43,py27-31-44,py27-32-43,py27-32-44' - TOXENV: 'py34-29-40,py34-29-41,py34-29-42,py34-29-43,py34-30-40,py34-30-41,py34-30-42,py34-30-43,py34-31-40,py34-31-41,py34-31-42,py34-31-43,py34-32-40,py34-32-41,py34-32-42,py34-32-43,py34-29-43,py34-29-44,py34-30-43,py34-30-44,py34-31-43,py34-31-44,py34-32-43,py34-32-44' - TOXENV: 'py35-29-40,py35-29-41,py35-29-42,py35-29-43,py35-30-40,py35-30-41,py35-30-42,py35-30-43,py35-31-40,py35-31-41,py35-31-42,py35-31-43,py35-32-40,py35-32-41,py35-32-42,py35-32-43,py35-29-43,py35-29-44,py35-30-43,py35-30-44,py35-31-43,py35-31-44,py35-32-43,py35-32-44' diff --git a/ci/templates/appveyor.yml b/ci/templates/appveyor.yml index 2455e981..eddf1905 100644 --- a/ci/templates/appveyor.yml +++ b/ci/templates/appveyor.yml @@ -5,7 +5,6 @@ cache: environment: matrix: - TOXENV: check - - TOXENV: '{{ py26_environments|join(",") }}' - TOXENV: '{{ py27_environments|join(",") }}' - TOXENV: '{{ py34_environments|join(",") }}' - TOXENV: '{{ py35_environments|join(",") }}' diff --git a/setup.py b/setup.py index 1cd7c64d..01cf0c76 100644 --- a/setup.py +++ b/setup.py @@ -105,7 +105,6 @@ def run(self): 'Operating System :: POSIX', 'Operating System :: Unix', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', @@ -121,8 +120,8 @@ def run(self): 'cover', 'coverage', 'pytest', 'py.test', 'distributed', 'parallel', ], install_requires=[ - 'pytest>=2.6.0', - 'coverage>=3.7.1' + 'pytest>=2.9', + 'coverage>=4.0' ], extras_require={ }, diff --git a/tox.ini b/tox.ini index 797c3081..9787afb6 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ [tox] envlist = check, - {py26,py27,py33,py34,py35,pypy}-{29,30,31,32}-{40,41,42,43}, + {py27,py33,py34,py35,pypy}-{29,30,31,32}-{40,41,42,43}, {py27,py33,py34,py35,py36,pypy}-{29,30,31,32}-{43,44}, docs @@ -23,20 +23,11 @@ setenv = passenv = * deps = - 28: pytest==2.8.7 - 28: pytest-xdist==1.17.1 - 29: pytest==2.9.2 - 29: pytest-xdist==1.17.1 - 30: pytest==3.0.7 - 30: pytest-xdist==1.20.1 - 31: pytest==3.1.3 - 31: pytest-xdist==1.20.1 - 32: pytest==3.2.3 - 32: pytest-xdist==1.20.1 + pytest-xdist==1.20.1 37: coverage==3.7.1 40: coverage==4.0.3 From 6dee02ab63e6fe9a3a375f12e87a75605a9e26fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 24 Nov 2017 08:55:39 +0200 Subject: [PATCH 18/22] Drop support for old coverage internals. --- src/pytest_cov/engine.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index b76873dd..824c0618 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -221,12 +221,9 @@ def testnodedown(self, node, error): data_suffix=data_suffix, config_file=self.cov_config) cov.start() - if hasattr(self.cov.data, 'read_fileobj'): # for coverage 4.0 - data = CoverageData() - data.read_fileobj(StringIO(node.slaveoutput['cov_slave_data'])) - cov.data.update(data) - else: - cov.data.lines, cov.data.arcs = node.slaveoutput['cov_slave_data'] + data = CoverageData() + data.read_fileobj(StringIO(node.slaveoutput['cov_slave_data'])) + cov.data.update(data) cov.stop() cov.save() path = node.slaveoutput['cov_slave_path'] @@ -303,12 +300,9 @@ def finish(self): # Send all the data to the master over the channel. self.config.slaveoutput['cov_slave_path'] = self.topdir self.config.slaveoutput['cov_slave_node_id'] = self.nodeid - if hasattr(self.cov.data, 'write_fileobj'): # for coverage 4.0 - buff = StringIO() - self.cov.data.write_fileobj(buff) - self.config.slaveoutput['cov_slave_data'] = buff.getvalue() - else: - self.config.slaveoutput['cov_slave_data'] = self.cov.data.lines, self.cov.data.arcs + buff = StringIO() + self.cov.data.write_fileobj(buff) + self.config.slaveoutput['cov_slave_data'] = buff.getvalue() def summary(self, stream): """Only the master reports so do nothing.""" From c065327561a7a2a0892f2b82f7baba3f8c9b4d44 Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 21 Nov 2017 09:16:58 +0200 Subject: [PATCH 19/22] Drop support for EOL Python 2.6 --- ci/bootstrap.py | 6 +++--- docs/conf.py | 2 +- setup.py | 1 + tests/test_pytest_cov.py | 8 +------- tox.ini | 1 - 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/ci/bootstrap.py b/ci/bootstrap.py index 98fe8c79..506c8d50 100755 --- a/ci/bootstrap.py +++ b/ci/bootstrap.py @@ -12,7 +12,7 @@ if __name__ == "__main__": base_path = dirname(dirname(abspath(__file__))) - print("Project path: {0}".format(base_path)) + print("Project path: {}".format(base_path)) env_path = join(base_path, ".tox", "bootstrap") if sys.platform == "win32": bin_path = join(env_path, "Scripts") @@ -20,7 +20,7 @@ bin_path = join(env_path, "bin") 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: subprocess.check_call(["virtualenv", env_path]) except Exception: @@ -46,7 +46,7 @@ tox_environments = [line for line in tox_environments if line not in ['clean', 'report', 'docs', 'check']] template_vars = {'tox_environments': tox_environments} - for py_ver in '26 27 33 34 35 py'.split(): + for py_ver in '27 33 34 35 py'.split(): template_vars['py%s_environments' % py_ver] = [x for x in tox_environments if x.startswith('py' + py_ver)] for name in os.listdir(join("ci", "templates")): diff --git a/docs/conf.py b/docs/conf.py index 220a371d..adb940c6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,7 @@ project = 'pytest-cov' year = '2016' author = 'pytest-cov contributors' -copyright = '{0}, {1}'.format(year, author) +copyright = '{}, {}'.format(year, author) version = release = '2.5.1' pygments_style = 'trac' diff --git a/setup.py b/setup.py index 01cf0c76..33fc18bb 100644 --- a/setup.py +++ b/setup.py @@ -105,6 +105,7 @@ 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.3', diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index b0de17e6..e4057ead 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -273,10 +273,7 @@ def test_term_output_dir(testdir): '--cov-report=term:' + DEST_DIR, script) - # backport of argparse to py26 doesn't display ArgumentTypeError message result.stderr.fnmatch_lines([ - '*argument --cov-report: *', - ] if tuple(sys.version_info[:2]) == (2, 6) else [ '*argument --cov-report: output specifier not supported for: "term:%s"*' % DEST_DIR, ]) assert result.ret != 0 @@ -290,10 +287,7 @@ def test_term_missing_output_dir(testdir): '--cov-report=term-missing:' + DEST_DIR, script) - # backport of argparse to py26 doesn't display ArgumentTypeError message result.stderr.fnmatch_lines([ - '*argument --cov-report: *', - ] if tuple(sys.version_info[:2]) == (2, 6) else [ '*argument --cov-report: output specifier not supported for: ' '"term-missing:%s"*' % DEST_DIR, ]) @@ -807,7 +801,7 @@ def test_dist_missing_data(testdir): exe = os.path.join(venv_path, 'bin', 'python') subprocess.check_call([ exe, - '-mpip' if sys.version_info >= (2, 7) else '-mpip.__main__', + '-mpip', 'install', 'py==%s' % py.__version__, 'pytest==%s' % pytest.__version__ diff --git a/tox.ini b/tox.ini index 9787afb6..1520bb65 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,6 @@ envlist = [testenv] basepython = pypy: pypy - py26: {env:TOXPYTHON:python2.6} {py27,docs}: {env:TOXPYTHON:python2.7} py33: {env:TOXPYTHON:python3.3} py34: {env:TOXPYTHON:python3.4} From da661726e5f48bb75a49d0e89afe8e8f2d337dfc Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 21 Nov 2017 09:20:40 +0200 Subject: [PATCH 20/22] Drop support for EOL Python 3.3 --- .travis.yml | 72 ------------------------------------------------- ci/bootstrap.py | 2 +- setup.py | 1 - tox.ini | 5 ++-- 4 files changed, 3 insertions(+), 77 deletions(-) diff --git a/.travis.yml b/.travis.yml index d3b79792..e91f442c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,54 +58,6 @@ matrix: - python: '2.7' env: - TOXENV=py27-32-43 - - python: '3.3' - env: - - TOXENV=py33-29-40 - - python: '3.3' - env: - - TOXENV=py33-29-41 - - python: '3.3' - env: - - TOXENV=py33-29-42 - - python: '3.3' - env: - - TOXENV=py33-29-43 - - python: '3.3' - env: - - TOXENV=py33-30-40 - - python: '3.3' - env: - - TOXENV=py33-30-41 - - python: '3.3' - env: - - TOXENV=py33-30-42 - - python: '3.3' - env: - - TOXENV=py33-30-43 - - python: '3.3' - env: - - TOXENV=py33-31-40 - - python: '3.3' - env: - - TOXENV=py33-31-41 - - python: '3.3' - env: - - TOXENV=py33-31-42 - - python: '3.3' - env: - - TOXENV=py33-31-43 - - python: '3.3' - env: - - TOXENV=py33-32-40 - - python: '3.3' - env: - - TOXENV=py33-32-41 - - python: '3.3' - env: - - TOXENV=py33-32-42 - - python: '3.3' - env: - - TOXENV=py33-32-43 - python: '3.4' env: - TOXENV=py34-29-40 @@ -274,30 +226,6 @@ matrix: - python: '2.7' env: - TOXENV=py27-32-44 - - python: '3.3' - env: - - TOXENV=py33-29-43 - - python: '3.3' - env: - - TOXENV=py33-29-44 - - python: '3.3' - env: - - TOXENV=py33-30-43 - - python: '3.3' - env: - - TOXENV=py33-30-44 - - python: '3.3' - env: - - TOXENV=py33-31-43 - - python: '3.3' - env: - - TOXENV=py33-31-44 - - python: '3.3' - env: - - TOXENV=py33-32-43 - - python: '3.3' - env: - - TOXENV=py33-32-44 - python: '3.4' env: - TOXENV=py34-29-43 diff --git a/ci/bootstrap.py b/ci/bootstrap.py index 506c8d50..7798166b 100755 --- a/ci/bootstrap.py +++ b/ci/bootstrap.py @@ -46,7 +46,7 @@ tox_environments = [line for line in tox_environments if line not in ['clean', 'report', 'docs', 'check']] template_vars = {'tox_environments': tox_environments} - for py_ver in '27 33 34 35 py'.split(): + for py_ver in '27 34 35 py'.split(): template_vars['py%s_environments' % py_ver] = [x for x in tox_environments if x.startswith('py' + py_ver)] for name in os.listdir(join("ci", "templates")): diff --git a/setup.py b/setup.py index 33fc18bb..34c4a354 100644 --- a/setup.py +++ b/setup.py @@ -108,7 +108,6 @@ def run(self): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', diff --git a/tox.ini b/tox.ini index 1520bb65..b8fa3b31 100644 --- a/tox.ini +++ b/tox.ini @@ -3,15 +3,14 @@ [tox] envlist = check, - {py27,py33,py34,py35,pypy}-{29,30,31,32}-{40,41,42,43}, - {py27,py33,py34,py35,py36,pypy}-{29,30,31,32}-{43,44}, + {py27,py34,py35,pypy}-{29,30,31,32}-{40,41,42,43}, + {py27,py34,py35,py36,pypy}-{29,30,31,32}-{43,44}, docs [testenv] basepython = pypy: pypy {py27,docs}: {env:TOXPYTHON:python2.7} - py33: {env:TOXPYTHON:python3.3} py34: {env:TOXPYTHON:python3.4} py35: {env:TOXPYTHON:python3.5} py36: {env:TOXPYTHON:python3.6} From a7328c7767b1526b69e4b089efee005d17ae40d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 24 Nov 2017 09:06:09 +0200 Subject: [PATCH 21/22] Add python version constraint like in https://github.com/pytest-dev/pluggy/pull/106. --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 34c4a354..bb61e68e 100644 --- a/setup.py +++ b/setup.py @@ -123,6 +123,7 @@ def run(self): 'pytest>=2.9', 'coverage>=4.0' ], + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', extras_require={ }, entry_points={ From 73e9d66775b800b83fb16663ad0ceea5da01ff2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 24 Nov 2017 09:11:49 +0200 Subject: [PATCH 22/22] Drop old coverage. Close #182. --- .travis.yml | 252 --------------------------------------------------- appveyor.yml | 8 +- setup.py | 2 +- tox.ini | 12 +-- 4 files changed, 8 insertions(+), 266 deletions(-) diff --git a/.travis.yml b/.travis.yml index e91f442c..5bc9c18f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,315 +10,63 @@ env: - TOXENV=docs matrix: include: - - python: '2.7' - env: - - TOXENV=py27-29-40 - - python: '2.7' - env: - - TOXENV=py27-29-41 - - python: '2.7' - env: - - TOXENV=py27-29-42 - - python: '2.7' - env: - - TOXENV=py27-29-43 - - python: '2.7' - env: - - TOXENV=py27-30-40 - - python: '2.7' - env: - - TOXENV=py27-30-41 - - python: '2.7' - env: - - TOXENV=py27-30-42 - - python: '2.7' - env: - - TOXENV=py27-30-43 - - python: '2.7' - env: - - TOXENV=py27-31-40 - - python: '2.7' - env: - - TOXENV=py27-31-41 - - python: '2.7' - env: - - TOXENV=py27-31-42 - - python: '2.7' - env: - - TOXENV=py27-31-43 - - python: '2.7' - env: - - TOXENV=py27-32-40 - - python: '2.7' - env: - - TOXENV=py27-32-41 - - python: '2.7' - env: - - TOXENV=py27-32-42 - - python: '2.7' - env: - - TOXENV=py27-32-43 - - python: '3.4' - env: - - TOXENV=py34-29-40 - - python: '3.4' - env: - - TOXENV=py34-29-41 - - python: '3.4' - env: - - TOXENV=py34-29-42 - - python: '3.4' - env: - - TOXENV=py34-29-43 - - python: '3.4' - env: - - TOXENV=py34-30-40 - - python: '3.4' - env: - - TOXENV=py34-30-41 - - python: '3.4' - env: - - TOXENV=py34-30-42 - - python: '3.4' - env: - - TOXENV=py34-30-43 - - python: '3.4' - env: - - TOXENV=py34-31-40 - - python: '3.4' - env: - - TOXENV=py34-31-41 - - python: '3.4' - env: - - TOXENV=py34-31-42 - - python: '3.4' - env: - - TOXENV=py34-31-43 - - python: '3.4' - env: - - TOXENV=py34-32-40 - - python: '3.4' - env: - - TOXENV=py34-32-41 - - python: '3.4' - env: - - TOXENV=py34-32-42 - - python: '3.4' - env: - - TOXENV=py34-32-43 - - python: '3.5' - env: - - TOXENV=py35-29-40 - - python: '3.5' - env: - - TOXENV=py35-29-41 - - python: '3.5' - env: - - TOXENV=py35-29-42 - - python: '3.5' - env: - - TOXENV=py35-29-43 - - python: '3.5' - env: - - TOXENV=py35-30-40 - - python: '3.5' - env: - - TOXENV=py35-30-41 - - python: '3.5' - env: - - TOXENV=py35-30-42 - - python: '3.5' - env: - - TOXENV=py35-30-43 - - python: '3.5' - env: - - TOXENV=py35-31-40 - - python: '3.5' - env: - - TOXENV=py35-31-41 - - python: '3.5' - env: - - TOXENV=py35-31-42 - - python: '3.5' - env: - - TOXENV=py35-31-43 - - python: '3.5' - env: - - TOXENV=py35-32-40 - - python: '3.5' - env: - - TOXENV=py35-32-41 - - python: '3.5' - env: - - TOXENV=py35-32-42 - - python: '3.5' - env: - - TOXENV=py35-32-43 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-29-40 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-29-41 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-29-42 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-29-43 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-30-40 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-30-41 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-30-42 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-30-43 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-31-40 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-31-41 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-31-42 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-31-43 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-32-40 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-32-41 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-32-42 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-32-43 - - python: '2.7' - env: - - TOXENV=py27-29-43 - python: '2.7' env: - TOXENV=py27-29-44 - - python: '2.7' - env: - - TOXENV=py27-30-43 - python: '2.7' env: - TOXENV=py27-30-44 - - python: '2.7' - env: - - TOXENV=py27-31-43 - python: '2.7' env: - TOXENV=py27-31-44 - - python: '2.7' - env: - - TOXENV=py27-32-43 - python: '2.7' env: - TOXENV=py27-32-44 - - python: '3.4' - env: - - TOXENV=py34-29-43 - python: '3.4' env: - TOXENV=py34-29-44 - - python: '3.4' - env: - - TOXENV=py34-30-43 - python: '3.4' env: - TOXENV=py34-30-44 - - python: '3.4' - env: - - TOXENV=py34-31-43 - python: '3.4' env: - TOXENV=py34-31-44 - - python: '3.4' - env: - - TOXENV=py34-32-43 - python: '3.4' env: - TOXENV=py34-32-44 - - python: '3.5' - env: - - TOXENV=py35-29-43 - python: '3.5' env: - TOXENV=py35-29-44 - - python: '3.5' - env: - - TOXENV=py35-30-43 - python: '3.5' env: - TOXENV=py35-30-44 - - python: '3.5' - env: - - TOXENV=py35-31-43 - python: '3.5' env: - TOXENV=py35-31-44 - - python: '3.5' - env: - - TOXENV=py35-32-43 - python: '3.5' env: - TOXENV=py35-32-44 - - python: '3.6' - env: - - TOXENV=py36-29-43 - python: '3.6' env: - TOXENV=py36-29-44 - - python: '3.6' - env: - - TOXENV=py36-30-43 - python: '3.6' env: - TOXENV=py36-30-44 - - python: '3.6' - env: - - TOXENV=py36-31-43 - python: '3.6' env: - TOXENV=py36-31-44 - - python: '3.6' - env: - - TOXENV=py36-32-43 - python: '3.6' env: - TOXENV=py36-32-44 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-29-43 - python: 'pypy-5.4' env: - TOXENV=pypy-29-44 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-30-43 - python: 'pypy-5.4' env: - TOXENV=pypy-30-44 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-31-43 - python: 'pypy-5.4' env: - TOXENV=pypy-31-44 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-32-43 - python: 'pypy-5.4' env: - TOXENV=pypy-32-44 diff --git a/appveyor.yml b/appveyor.yml index 6574ac9c..48060ab3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,10 +5,10 @@ cache: environment: matrix: - TOXENV: check - - TOXENV: 'py27-29-40,py27-29-41,py27-29-42,py27-29-43,py27-30-40,py27-30-41,py27-30-42,py27-30-43,py27-31-40,py27-31-41,py27-31-42,py27-31-43,py27-32-40,py27-32-41,py27-32-42,py27-32-43,py27-29-43,py27-29-44,py27-30-43,py27-30-44,py27-31-43,py27-31-44,py27-32-43,py27-32-44' - - TOXENV: 'py34-29-40,py34-29-41,py34-29-42,py34-29-43,py34-30-40,py34-30-41,py34-30-42,py34-30-43,py34-31-40,py34-31-41,py34-31-42,py34-31-43,py34-32-40,py34-32-41,py34-32-42,py34-32-43,py34-29-43,py34-29-44,py34-30-43,py34-30-44,py34-31-43,py34-31-44,py34-32-43,py34-32-44' - - TOXENV: 'py35-29-40,py35-29-41,py35-29-42,py35-29-43,py35-30-40,py35-30-41,py35-30-42,py35-30-43,py35-31-40,py35-31-41,py35-31-42,py35-31-43,py35-32-40,py35-32-41,py35-32-42,py35-32-43,py35-29-43,py35-29-44,py35-30-43,py35-30-44,py35-31-43,py35-31-44,py35-32-43,py35-32-44' - - TOXENV: 'pypy-29-40,pypy-29-41,pypy-29-42,pypy-29-43,pypy-30-40,pypy-30-41,pypy-30-42,pypy-30-43,pypy-31-40,pypy-31-41,pypy-31-42,pypy-31-43,pypy-32-40,pypy-32-41,pypy-32-42,pypy-32-43,pypy-29-43,pypy-29-44,pypy-30-43,pypy-30-44,pypy-31-43,pypy-31-44,pypy-32-43,pypy-32-44' + - TOXENV: 'py27-29-44,py27-30-44,py27-31-44,py27-32-44' + - TOXENV: 'py34-29-44,py34-30-44,py34-31-44,py34-32-44' + - TOXENV: 'py35-29-44,py35-30-44,py35-31-44,py35-32-44' + - TOXENV: 'pypy-29-44,pypy-30-44,pypy-31-44,pypy-32-44' init: - ps: echo $env:TOXENV diff --git a/setup.py b/setup.py index bb61e68e..31c7dad0 100644 --- a/setup.py +++ b/setup.py @@ -121,7 +121,7 @@ def run(self): ], install_requires=[ 'pytest>=2.9', - 'coverage>=4.0' + 'coverage>=4.4' ], python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', extras_require={ diff --git a/tox.ini b/tox.ini index b8fa3b31..9f17ec07 100644 --- a/tox.ini +++ b/tox.ini @@ -3,8 +3,7 @@ [tox] envlist = check, - {py27,py34,py35,pypy}-{29,30,31,32}-{40,41,42,43}, - {py27,py34,py35,py36,pypy}-{29,30,31,32}-{43,44}, + {py27,py34,py35,py36,pypy}-{29,30,31,32}-44, docs [testenv] @@ -24,15 +23,10 @@ deps = 29: pytest==2.9.2 30: pytest==3.0.7 31: pytest==3.1.3 - 32: pytest==3.2.3 + 32: pytest==3.2.5 pytest-xdist==1.20.1 - 37: coverage==3.7.1 - 40: coverage==4.0.3 - 41: coverage==4.1 - 42: coverage==4.2 - 43: coverage==4.3.4 - 44: coverage==4.4.1 + 44: coverage==4.4.2 virtualenv hunter