From fddfff7583c2662a772876a87ecd92847afbcdcb Mon Sep 17 00:00:00 2001 From: Michael Elovskikh Date: Fri, 10 Jun 2016 14:09:45 +0500 Subject: [PATCH 1/2] Dont fail on xdist with bare --cov Closes #110 --- src/pytest_cov/plugin.py | 2 ++ tests/test_pytest_cov.py | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index a81ea2ed..d8394dbb 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -93,6 +93,8 @@ def pytest_configure(config): if not config.pluginmanager.hasplugin('_cov'): if not config.option.cov_report: config.option.cov_report = ['term'] + if config.option.cov_source == [True]: + config.option.cov_source = None plugin = CovPlugin(config.option, config.pluginmanager, start=False) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 15a2e147..d43c5dfe 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -911,6 +911,23 @@ def test_dist_boxed(testdir): assert result.ret == 0 +@pytest.mark.skipif('sys.platform == "win32"') +def test_dist_bare_cov(testdir): + script = testdir.makepyfile(SCRIPT_SIMPLE) + + result = testdir.runpytest('-v', + '--cov', + '-n', '1', + script) + + result.stdout.fnmatch_lines([ + '*- coverage: platform *, python * -*', + 'test_dist_bare_cov* %s*' % SCRIPT_SIMPLE_RESULT, + '*1 passed*' + ]) + assert result.ret == 0 + + def test_not_started_plugin_does_not_fail(testdir): plugin = pytest_cov.plugin.CovPlugin(None, None, start=False) plugin.pytest_runtestloop(None) @@ -1041,4 +1058,3 @@ def test_do_not_append_coverage(testdir, opts): 'test_1* 0%', 'test_2* %s*' % SCRIPT2_RESULT, ]) - From 815c81d2041ca24c51b38e4c222e519203b912a3 Mon Sep 17 00:00:00 2001 From: Michael Elovskikh Date: Sun, 12 Jun 2016 23:43:47 +0500 Subject: [PATCH 2/2] Updated changelog and authors --- AUTHORS.rst | 1 + CHANGELOG.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index e817d705..c0313aab 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -15,3 +15,4 @@ Authors * Alec Nikolas Reiter - https://github.com/justanr * Patrick Lannigan - https://github.com/unholysampler * David Szotten - https://github.com/davidszotten +* Michael Elovskikh - https://github.com/wronglink diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0f6868b6..d2a2c9ea 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,8 @@ Changelog * For coverage >= 4.0, match the default behaviour of `coverage report` and error if coverage fails to find the source instead of just printing a warning. Contributed by David Szotten in `PR#116 `_. +* Fixed bug occurred when bare ``--cov`` parameter was used with xdist. + Contributed by Michael Elovskikh in `PR#120 `_. 2.2.1 (2016-01-30)