You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
3.9 KiB
127 lines
3.9 KiB
diff -up pytest-cov-2.1.0/tests/test_pytest_cov.py.xdist pytest-cov-2.1.0/tests/test_pytest_cov.py
|
|
--- pytest-cov-2.1.0/tests/test_pytest_cov.py.xdist 2015-08-22 18:04:15.000000000 -0600
|
|
+++ pytest-cov-2.1.0/tests/test_pytest_cov.py 2015-09-14 10:29:43.633141009 -0600
|
|
@@ -102,6 +102,12 @@ def test_run_target():
|
|
p.join()
|
|
'''
|
|
|
|
+try:
|
|
+ import xdist
|
|
+ HAS_XDIST = True
|
|
+except:
|
|
+ HAS_XDIST = False
|
|
+
|
|
SCRIPT_FAIL = '''
|
|
def test_fail():
|
|
assert False
|
|
@@ -113,7 +119,11 @@ SCRIPT2_RESULT = '3 * 100%'
|
|
CHILD_SCRIPT_RESULT = '6 * 100%'
|
|
PARENT_SCRIPT_RESULT = '8 * 100%'
|
|
|
|
-xdist = pytest.mark.parametrize('opts', ['', '-n 1'], ids=['nodist', 'xdist'])
|
|
+try:
|
|
+ import xdist
|
|
+ xdist = pytest.mark.parametrize('opts', ['', '-n 1'], ids=['nodist', 'xdist'])
|
|
+except:
|
|
+ xdist = pytest.mark.parametrize('opts', [''], ids=['nodist'])
|
|
|
|
|
|
def test_central(testdir):
|
|
@@ -253,6 +263,7 @@ show_missing = true
|
|
assert result.ret == 0
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_no_cov_on_fail(testdir):
|
|
script = testdir.makepyfile(SCRIPT_FAIL)
|
|
|
|
@@ -266,6 +277,7 @@ def test_no_cov_on_fail(testdir):
|
|
result.stdout.fnmatch_lines(['*1 failed*'])
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_dist_combine_racecondition(testdir):
|
|
script = testdir.makepyfile("""
|
|
import pytest
|
|
@@ -292,6 +304,7 @@ def test_foo(foo):
|
|
assert result.ret == 0
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_dist_collocated(testdir):
|
|
script = testdir.makepyfile(SCRIPT)
|
|
|
|
@@ -311,6 +324,7 @@ def test_dist_collocated(testdir):
|
|
assert result.ret == 0
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_dist_not_collocated(testdir):
|
|
script = testdir.makepyfile(SCRIPT)
|
|
dir1 = testdir.mkdir('dir1')
|
|
@@ -376,6 +390,7 @@ omit =
|
|
assert result.ret == 0
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_dist_subprocess_collocated(testdir):
|
|
scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT,
|
|
child_script=SCRIPT_CHILD)
|
|
@@ -397,6 +412,7 @@ def test_dist_subprocess_collocated(test
|
|
assert result.ret == 0
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_dist_subprocess_not_collocated(testdir, tmpdir):
|
|
scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT,
|
|
child_script=SCRIPT_CHILD)
|
|
@@ -442,6 +458,7 @@ def test_empty_report(testdir):
|
|
assert not matching_lines
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_dist_missing_data(testdir):
|
|
venv_path = os.path.join(str(testdir.tmpdir), 'venv')
|
|
virtualenv.create_environment(venv_path)
|
|
@@ -548,6 +565,7 @@ def test_cover_conftest(testdir):
|
|
result.stdout.fnmatch_lines([CONF_RESULT])
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_cover_looponfail(testdir, monkeypatch):
|
|
testdir.makepyfile(mod=MODULE)
|
|
testdir.makeconftest(CONFTEST)
|
|
@@ -566,6 +584,7 @@ def test_cover_looponfail(testdir, monke
|
|
)
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_cover_conftest_dist(testdir):
|
|
testdir.makepyfile(mod=MODULE)
|
|
testdir.makeconftest(CONFTEST)
|
|
@@ -615,6 +634,7 @@ def test_coveragerc(testdir):
|
|
result.stdout.fnmatch_lines(['test_coveragerc* %s' % EXCLUDED_RESULT])
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_coveragerc_dist(testdir):
|
|
testdir.makefile('', coveragerc=COVERAGERC)
|
|
script = testdir.makepyfile(EXCLUDED_TEST)
|
|
@@ -661,7 +681,7 @@ def test_foo():
|
|
SCRIPT_SIMPLE_RESULT = '4 * 100%'
|
|
|
|
|
|
-@pytest.mark.skipif('sys.platform == "win32"')
|
|
+@pytest.mark.skipif('sys.platform == "win32" or not HAS_XDIST')
|
|
def test_dist_boxed(testdir):
|
|
script = testdir.makepyfile(SCRIPT_SIMPLE)
|
|
|
|
@@ -737,6 +757,7 @@ data_file = %s
|
|
assert glob.glob(str(testdir.tmpdir.join('some/special/place/coverage-data*')))
|
|
|
|
|
|
+@pytest.mark.skipif("not HAS_XDIST")
|
|
def test_external_data_file_xdist(testdir):
|
|
script = testdir.makepyfile(SCRIPT)
|
|
testdir.tmpdir.join('.coveragerc').write("""
|