diff --git a/.travis.yml b/.travis.yml index 1d6ed662..5bc9c18f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,438 +10,66 @@ 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 - - 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.7' - env: - - TOXENV=py27-28-40 - - python: '2.7' - env: - - TOXENV=py27-28-41 - - python: '2.7' - env: - - TOXENV=py27-28-42 - - python: '2.7' - env: - - TOXENV=py27-28-43 - - 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: '3.3' - env: - - TOXENV=py33-28-40 - - python: '3.3' - env: - - TOXENV=py33-28-41 - - python: '3.3' - env: - - TOXENV=py33-28-42 - - python: '3.3' - env: - - TOXENV=py33-28-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.4' - env: - - TOXENV=py34-28-40 - - python: '3.4' - env: - - TOXENV=py34-28-41 - - python: '3.4' - env: - - TOXENV=py34-28-42 - - python: '3.4' - env: - - TOXENV=py34-28-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.5' - env: - - TOXENV=py35-28-40 - - python: '3.5' - env: - - TOXENV=py35-28-41 - - python: '3.5' - env: - - TOXENV=py35-28-42 - - python: '3.5' - env: - - TOXENV=py35-28-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: 'pypy-5.4' - env: - - TOXENV=pypy-28-40 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-28-41 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-28-42 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-28-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: '2.7' - env: - - TOXENV=py27-28-43 - - python: '2.7' - env: - - TOXENV=py27-28-44 - - 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: '3.3' - env: - - TOXENV=py33-28-43 - - python: '3.3' - env: - - TOXENV=py33-28-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.4' - env: - - TOXENV=py34-28-43 - - python: '3.4' - env: - - TOXENV=py34-28-44 - - python: '3.4' + - python: '2.7' env: - - TOXENV=py34-29-43 + - TOXENV=py27-32-44 - 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.5' - env: - - TOXENV=py35-28-43 - - python: '3.5' - env: - - TOXENV=py35-28-44 - - python: '3.5' + - python: '3.4' env: - - TOXENV=py35-29-43 + - TOXENV=py34-32-44 - 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.6' - env: - - TOXENV=py36-28-43 - - python: '3.6' - env: - - TOXENV=py36-28-44 - - python: '3.6' + - python: '3.5' env: - - TOXENV=py36-29-43 + - TOXENV=py35-32-44 - 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: 'pypy-5.4' - env: - - TOXENV=pypy-28-43 - - python: 'pypy-5.4' - env: - - TOXENV=pypy-28-44 - - python: 'pypy-5.4' + - python: '3.6' env: - - TOXENV=pypy-29-43 + - TOXENV=py36-32-44 - 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 + - TOXENV=pypy-31-44 - python: 'pypy-5.4' env: - - TOXENV=pypy-31-44 + - TOXENV=pypy-32-44 before_install: - python --version - uname -a diff --git a/appveyor.yml b/appveyor.yml index 89aa4da8..48060ab3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,11 +5,10 @@ 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: '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/ci/bootstrap.py b/ci/bootstrap.py index 98fe8c79..7798166b 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 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/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/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 1cd7c64d..31c7dad0 100644 --- a/setup.py +++ b/setup.py @@ -105,10 +105,9 @@ def run(self): 'Operating System :: POSIX', 'Operating System :: Unix', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.6', + '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', @@ -121,9 +120,10 @@ 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.4' ], + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', extras_require={ }, entry_points={ diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 6fd22908..824c0618 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -25,6 +25,8 @@ 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 = [] self.topdir = os.getcwd() @@ -136,10 +138,13 @@ 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, + branch=self.cov_branch, + data_file=os.path.abspath(self.cov.config.data_file), + config_file=self.cov_config) if self.cov_append: self.cov.load() else: @@ -152,8 +157,13 @@ 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() + node_desc = self.get_node_desc(sys.platform, sys.version_info) self.node_descs.add(node_desc) @@ -170,6 +180,10 @@ 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, + branch=self.cov_branch, + data_file=os.path.abspath(self.cov.config.data_file), + config_file=self.cov_config) if self.cov_append: self.cov.load() else: @@ -207,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'] @@ -228,6 +239,9 @@ def finish(self): # Combine all the suffix files into the data file. self.cov.stop() + self.cov.save() + self.cov = self.combining_cov + self.cov.load() self.cov.combine() self.cov.save() @@ -286,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.""" 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/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index e056bb0d..e4057ead 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' @@ -168,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], @@ -271,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 @@ -288,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, ]) @@ -400,6 +396,79 @@ def test_central_coveragerc(testdir, prop): assert result.ret == 0 +@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') + mod2.write(SCRIPT) + script = testdir.makepyfile(''' +from mod import * +''') + testdir.tmpdir.join('setup.cfg').write(""" +[coverage:paths] +source = + src + aliased +[coverage:run] +source = mod +parallel = true +%s +""" % prop.conf) + + 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()+prop.args) + + 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_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) testdir.tmpdir.join('.coveragerc').write(""" @@ -524,7 +593,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(), @@ -581,8 +657,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 @@ -666,15 +742,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) @@ -719,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 89fc9a1d..9f17ec07 100644 --- a/tox.ini +++ b/tox.ini @@ -3,16 +3,13 @@ [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}, + {py27,py34,py35,py36,pypy}-{29,30,31,32}-44, docs [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} py35: {env:TOXPYTHON:python3.5} py36: {env:TOXPYTHON:python3.6} @@ -23,27 +20,17 @@ 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.18.2 - 31: pytest==3.1.3 - 31: pytest-xdist==1.18.2 + 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 - process-tests==1.2.1 + hunter + process-tests==1.2.2 six fields pip_pre = true