parent
06e3c0f1cd
commit
d825a64f7e
@ -1,126 +0,0 @@
|
||||
diff -up pytest-cov-2.2.0/tests/test_pytest_cov.py.xdist pytest-cov-2.2.0/tests/test_pytest_cov.py
|
||||
--- pytest-cov-2.2.0/tests/test_pytest_cov.py.xdist 2015-10-03 07:33:53.000000000 -0600
|
||||
+++ pytest-cov-2.2.0/tests/test_pytest_cov.py 2015-10-05 09:07:26.548035911 -0600
|
||||
@@ -124,6 +124,12 @@ def test_run_target():
|
||||
p.join()
|
||||
'''
|
||||
|
||||
+try:
|
||||
+ import xdist
|
||||
+ HAS_XDIST = True
|
||||
+except:
|
||||
+ HAS_XDIST = False
|
||||
+
|
||||
SCRIPT_FAIL = '''
|
||||
def test_fail():
|
||||
assert False
|
||||
@@ -135,7 +141,11 @@ SCRIPT2_RESULT = '3 * 100%'
|
||||
CHILD_SCRIPT_RESULT = '[56] * 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):
|
||||
@@ -291,6 +301,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)
|
||||
|
||||
@@ -304,6 +315,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
|
||||
@@ -330,6 +342,7 @@ def test_foo(foo):
|
||||
assert result.ret == 0
|
||||
|
||||
|
||||
+@pytest.mark.skipif("not HAS_XDIST")
|
||||
def test_dist_collocated(testdir):
|
||||
script = testdir.makepyfile(SCRIPT)
|
||||
|
||||
@@ -349,6 +362,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')
|
||||
@@ -438,6 +452,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)
|
||||
@@ -459,6 +474,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)
|
||||
@@ -504,6 +520,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)
|
||||
@@ -616,6 +633,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)
|
||||
@@ -634,6 +652,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)
|
||||
@@ -683,6 +702,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)
|
||||
@@ -729,7 +749,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)
|
||||
|
||||
@@ -805,6 +825,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("""
|
Loading…
Reference in new issue