Run pre-commit: black, whitespaces, rst
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@ pytest_plugins = "pytester"
|
||||
@pytest.fixture(autouse=True)
|
||||
def _divert_atexit(request, monkeypatch):
|
||||
import atexit
|
||||
|
||||
finalizers = []
|
||||
|
||||
def finish():
|
||||
@@ -31,10 +32,12 @@ def _divert_atexit(request, monkeypatch):
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption('--gx',
|
||||
action="append",
|
||||
dest="gspecs",
|
||||
help="add a global test environment, XSpec-syntax. ")
|
||||
parser.addoption(
|
||||
"--gx",
|
||||
action="append",
|
||||
dest="gspecs",
|
||||
help="add a global test environment, XSpec-syntax. ",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
from xdist.dsession import DSession
|
||||
from xdist.report import report_collection_diff
|
||||
from xdist.scheduler import (
|
||||
EachScheduling,
|
||||
LoadScheduling,
|
||||
)
|
||||
from xdist.scheduler import EachScheduling, LoadScheduling
|
||||
|
||||
import py
|
||||
import pytest
|
||||
@@ -60,7 +57,7 @@ class TestEachScheduling:
|
||||
sched = EachScheduling(config)
|
||||
sched.add_node(node1)
|
||||
sched.add_node(node2)
|
||||
collection = ["a.py::test_1", ]
|
||||
collection = ["a.py::test_1"]
|
||||
assert not sched.collection_is_completed
|
||||
sched.add_node_collection(node1, collection)
|
||||
assert not sched.collection_is_completed
|
||||
@@ -70,8 +67,8 @@ class TestEachScheduling:
|
||||
assert sched.node2collection[node2] == collection
|
||||
sched.schedule()
|
||||
assert sched.tests_finished
|
||||
assert node1.sent == ['ALL']
|
||||
assert node2.sent == ['ALL']
|
||||
assert node1.sent == ["ALL"]
|
||||
assert node2.sent == ["ALL"]
|
||||
sched.mark_test_complete(node1, 0)
|
||||
assert sched.tests_finished
|
||||
sched.mark_test_complete(node2, 0)
|
||||
@@ -82,7 +79,7 @@ class TestEachScheduling:
|
||||
config = testdir.parseconfig("--tx=popen")
|
||||
sched = EachScheduling(config)
|
||||
sched.add_node(node1)
|
||||
collection = ["a.py::test_1", ]
|
||||
collection = ["a.py::test_1"]
|
||||
assert not sched.collection_is_completed
|
||||
sched.add_node_collection(node1, collection)
|
||||
assert sched.collection_is_completed
|
||||
@@ -230,7 +227,7 @@ class TestLoadScheduling:
|
||||
sched.schedule()
|
||||
assert len(collect_hook.reports) == 1
|
||||
rep = collect_hook.reports[0]
|
||||
assert 'Different tests were collected between' in rep.longrepr
|
||||
assert "Different tests were collected between" in rep.longrepr
|
||||
|
||||
|
||||
class TestDistReporter:
|
||||
@@ -238,6 +235,7 @@ class TestDistReporter:
|
||||
def test_rsync_printing(self, testdir, linecomp):
|
||||
config = testdir.parseconfig()
|
||||
from _pytest.pytest_terminal import TerminalReporter
|
||||
|
||||
rep = TerminalReporter(config, file=linecomp.stringio)
|
||||
config.pluginmanager.register(rep, "terminalreporter")
|
||||
dsession = DSession(config)
|
||||
@@ -249,6 +247,7 @@ class TestDistReporter:
|
||||
class gw2:
|
||||
id = "X2"
|
||||
spec = execnet.XSpec("popen")
|
||||
|
||||
# class rinfo:
|
||||
# version_info = (2, 5, 1, 'final', 0)
|
||||
# executable = "hello"
|
||||
@@ -260,47 +259,50 @@ class TestDistReporter:
|
||||
# "*X1*popen*xyz*2.5*"
|
||||
# ])
|
||||
dsession.pytest_xdist_rsyncstart(source="hello", gateways=[gw1, gw2])
|
||||
linecomp.assert_contains_lines(["[X1,X2] rsyncing: hello", ])
|
||||
linecomp.assert_contains_lines(["[X1,X2] rsyncing: hello"])
|
||||
|
||||
|
||||
def test_report_collection_diff_equal():
|
||||
"""Test reporting of equal collections."""
|
||||
from_collection = to_collection = ['aaa', 'bbb', 'ccc']
|
||||
from_collection = to_collection = ["aaa", "bbb", "ccc"]
|
||||
assert report_collection_diff(from_collection, to_collection, 1, 2) is None
|
||||
|
||||
|
||||
def test_report_collection_diff_different():
|
||||
"""Test reporting of different collections."""
|
||||
from_collection = ['aaa', 'bbb', 'ccc', 'YYY']
|
||||
to_collection = ['aZa', 'bbb', 'XXX', 'ccc']
|
||||
from_collection = ["aaa", "bbb", "ccc", "YYY"]
|
||||
to_collection = ["aZa", "bbb", "XXX", "ccc"]
|
||||
error_message = (
|
||||
'Different tests were collected between 1 and 2. The difference is:\n'
|
||||
'--- 1\n'
|
||||
'\n'
|
||||
'+++ 2\n'
|
||||
'\n'
|
||||
'@@ -1,4 +1,4 @@\n'
|
||||
'\n'
|
||||
'-aaa\n'
|
||||
'+aZa\n'
|
||||
' bbb\n'
|
||||
'+XXX\n'
|
||||
' ccc\n'
|
||||
'-YYY')
|
||||
"Different tests were collected between 1 and 2. The difference is:\n"
|
||||
"--- 1\n"
|
||||
"\n"
|
||||
"+++ 2\n"
|
||||
"\n"
|
||||
"@@ -1,4 +1,4 @@\n"
|
||||
"\n"
|
||||
"-aaa\n"
|
||||
"+aZa\n"
|
||||
" bbb\n"
|
||||
"+XXX\n"
|
||||
" ccc\n"
|
||||
"-YYY"
|
||||
)
|
||||
|
||||
msg = report_collection_diff(from_collection, to_collection, '1', '2')
|
||||
msg = report_collection_diff(from_collection, to_collection, "1", "2")
|
||||
assert msg == error_message
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason="duplicate test ids not supported yet")
|
||||
def test_pytest_issue419(testdir):
|
||||
testdir.makepyfile("""
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
|
||||
@pytest.mark.parametrize('birth_year', [1988, 1988, ])
|
||||
def test_2011_table(birth_year):
|
||||
pass
|
||||
""")
|
||||
"""
|
||||
)
|
||||
reprec = testdir.inline_run("-n1")
|
||||
reprec.assertoutcome(passed=2)
|
||||
assert 0
|
||||
|
||||
@@ -60,7 +60,7 @@ class TestStatRecorder:
|
||||
p.remove()
|
||||
# make check()'s visit() call return our just removed
|
||||
# path as if we were in a race condition
|
||||
monkeypatch.setattr(tmp, 'visit', lambda *args: [p])
|
||||
monkeypatch.setattr(tmp, "visit", lambda *args: [p])
|
||||
|
||||
changed = sd.check()
|
||||
assert changed
|
||||
@@ -84,7 +84,7 @@ class TestStatRecorder:
|
||||
sd = StatRecorder([tmp])
|
||||
|
||||
ret_values = [True, False]
|
||||
monkeypatch.setattr(StatRecorder, 'check', lambda self: ret_values.pop())
|
||||
monkeypatch.setattr(StatRecorder, "check", lambda self: ret_values.pop())
|
||||
sd.waitonchange(checkinterval=0.2)
|
||||
assert not ret_values
|
||||
|
||||
@@ -110,19 +110,25 @@ class TestRemoteControl:
|
||||
assert not failures
|
||||
|
||||
def test_failure_change(self, testdir):
|
||||
modcol = testdir.getitem("""
|
||||
modcol = testdir.getitem(
|
||||
"""
|
||||
def test_func():
|
||||
assert 0
|
||||
""")
|
||||
"""
|
||||
)
|
||||
control = RemoteControl(modcol.config)
|
||||
control.loop_once()
|
||||
assert control.failures
|
||||
modcol.fspath.write(py.code.Source("""
|
||||
modcol.fspath.write(
|
||||
py.code.Source(
|
||||
"""
|
||||
def test_func():
|
||||
assert 1
|
||||
def test_new():
|
||||
assert 0
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
removepyc(modcol.fspath)
|
||||
control.loop_once()
|
||||
assert not control.failures
|
||||
@@ -131,14 +137,17 @@ class TestRemoteControl:
|
||||
assert str(control.failures).find("test_new") != -1
|
||||
|
||||
def test_failure_subdir_no_init(self, testdir):
|
||||
modcol = testdir.getitem("""
|
||||
modcol = testdir.getitem(
|
||||
"""
|
||||
def test_func():
|
||||
assert 0
|
||||
""")
|
||||
"""
|
||||
)
|
||||
parent = modcol.fspath.dirpath().dirpath()
|
||||
parent.chdir()
|
||||
modcol.config.args = [py.path.local(x).relto(parent)
|
||||
for x in modcol.config.args]
|
||||
modcol.config.args = [
|
||||
py.path.local(x).relto(parent) for x in modcol.config.args
|
||||
]
|
||||
control = RemoteControl(modcol.config)
|
||||
control.loop_once()
|
||||
assert control.failures
|
||||
@@ -148,70 +157,87 @@ class TestRemoteControl:
|
||||
|
||||
class TestLooponFailing:
|
||||
def test_looponfail_from_fail_to_ok(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
modcol = testdir.getmodulecol(
|
||||
"""
|
||||
def test_one():
|
||||
x = 0
|
||||
assert x == 1
|
||||
def test_two():
|
||||
assert 1
|
||||
""")
|
||||
"""
|
||||
)
|
||||
remotecontrol = RemoteControl(modcol.config)
|
||||
remotecontrol.loop_once()
|
||||
assert len(remotecontrol.failures) == 1
|
||||
|
||||
modcol.fspath.write(py.code.Source("""
|
||||
modcol.fspath.write(
|
||||
py.code.Source(
|
||||
"""
|
||||
def test_one():
|
||||
assert 1
|
||||
def test_two():
|
||||
assert 1
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
removepyc(modcol.fspath)
|
||||
remotecontrol.loop_once()
|
||||
assert not remotecontrol.failures
|
||||
|
||||
def test_looponfail_from_one_to_two_tests(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
modcol = testdir.getmodulecol(
|
||||
"""
|
||||
def test_one():
|
||||
assert 0
|
||||
""")
|
||||
"""
|
||||
)
|
||||
remotecontrol = RemoteControl(modcol.config)
|
||||
remotecontrol.loop_once()
|
||||
assert len(remotecontrol.failures) == 1
|
||||
assert 'test_one' in remotecontrol.failures[0]
|
||||
assert "test_one" in remotecontrol.failures[0]
|
||||
|
||||
modcol.fspath.write(py.code.Source("""
|
||||
modcol.fspath.write(
|
||||
py.code.Source(
|
||||
"""
|
||||
def test_one():
|
||||
assert 1 # passes now
|
||||
def test_two():
|
||||
assert 0 # new and fails
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
removepyc(modcol.fspath)
|
||||
remotecontrol.loop_once()
|
||||
assert len(remotecontrol.failures) == 0
|
||||
remotecontrol.loop_once()
|
||||
assert len(remotecontrol.failures) == 1
|
||||
assert 'test_one' not in remotecontrol.failures[0]
|
||||
assert 'test_two' in remotecontrol.failures[0]
|
||||
assert "test_one" not in remotecontrol.failures[0]
|
||||
assert "test_two" in remotecontrol.failures[0]
|
||||
|
||||
@py.test.mark.xfail(py.test.__version__ >= "3.1",
|
||||
reason="broken by pytest 3.1+")
|
||||
@py.test.mark.xfail(py.test.__version__ >= "3.1", reason="broken by pytest 3.1+")
|
||||
def test_looponfail_removed_test(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
modcol = testdir.getmodulecol(
|
||||
"""
|
||||
def test_one():
|
||||
assert 0
|
||||
def test_two():
|
||||
assert 0
|
||||
""")
|
||||
"""
|
||||
)
|
||||
remotecontrol = RemoteControl(modcol.config)
|
||||
remotecontrol.loop_once()
|
||||
assert len(remotecontrol.failures) == 2
|
||||
|
||||
modcol.fspath.write(py.code.Source("""
|
||||
modcol.fspath.write(
|
||||
py.code.Source(
|
||||
"""
|
||||
def test_xxx(): # renamed test
|
||||
assert 0
|
||||
def test_two():
|
||||
assert 1 # pass now
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
removepyc(modcol.fspath)
|
||||
remotecontrol.loop_once()
|
||||
assert len(remotecontrol.failures) == 0
|
||||
@@ -220,10 +246,12 @@ class TestLooponFailing:
|
||||
assert len(remotecontrol.failures) == 1
|
||||
|
||||
def test_looponfail_multiple_errors(self, testdir, monkeypatch):
|
||||
modcol = testdir.getmodulecol("""
|
||||
modcol = testdir.getmodulecol(
|
||||
"""
|
||||
def test_one():
|
||||
assert 0
|
||||
""")
|
||||
"""
|
||||
)
|
||||
remotecontrol = RemoteControl(modcol.config)
|
||||
orig_runsession = remotecontrol.runsession
|
||||
|
||||
@@ -233,18 +261,20 @@ class TestLooponFailing:
|
||||
print(failures)
|
||||
return failures * 2, reports, collection_failed
|
||||
|
||||
monkeypatch.setattr(remotecontrol, 'runsession', runsession_dups)
|
||||
monkeypatch.setattr(remotecontrol, "runsession", runsession_dups)
|
||||
remotecontrol.loop_once()
|
||||
assert len(remotecontrol.failures) == 1
|
||||
|
||||
|
||||
class TestFunctional:
|
||||
def test_fail_to_ok(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
p = testdir.makepyfile(
|
||||
"""
|
||||
def test_one():
|
||||
x = 0
|
||||
assert x == 1
|
||||
""")
|
||||
"""
|
||||
)
|
||||
# p = testdir.mkdir("sub").join(p1.basename)
|
||||
# p1.move(p)
|
||||
child = testdir.spawn_pytest("-f %s --traceconfig" % p)
|
||||
@@ -253,21 +283,27 @@ class TestFunctional:
|
||||
child.expect("1 failed")
|
||||
child.expect("### LOOPONFAILING ####")
|
||||
child.expect("waiting for changes")
|
||||
p.write(py.code.Source("""
|
||||
p.write(
|
||||
py.code.Source(
|
||||
"""
|
||||
def test_one():
|
||||
x = 1
|
||||
assert x == 1
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
child.expect(".*1 passed.*")
|
||||
child.kill(15)
|
||||
|
||||
def test_xfail_passes(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
p = testdir.makepyfile(
|
||||
"""
|
||||
import py
|
||||
@py.test.mark.xfail
|
||||
def test_one():
|
||||
pass
|
||||
""")
|
||||
"""
|
||||
)
|
||||
child = testdir.spawn_pytest("-f %s" % p)
|
||||
child.expect("1 xpass")
|
||||
# child.expect("### LOOPONFAILING ####")
|
||||
|
||||
@@ -2,21 +2,23 @@ import pytest
|
||||
|
||||
|
||||
class TestHooks:
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def create_test_file(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import os
|
||||
def test_a(): pass
|
||||
def test_b(): pass
|
||||
def test_c(): pass
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
def test_runtest_logreport(self, testdir):
|
||||
"""Test that log reports from pytest_runtest_logreport when running
|
||||
with xdist contain "node", "nodeid" and "worker_id" attributes. (#8)
|
||||
"""
|
||||
testdir.makeconftest("""
|
||||
testdir.makeconftest(
|
||||
"""
|
||||
def pytest_runtest_logreport(report):
|
||||
if hasattr(report, 'node'):
|
||||
if report.when == "call":
|
||||
@@ -27,29 +29,31 @@ class TestHooks:
|
||||
else:
|
||||
print("HOOK: %s %s"
|
||||
% (report.nodeid, report.worker_id))
|
||||
""")
|
||||
res = testdir.runpytest('-n1', '-s')
|
||||
res.stdout.fnmatch_lines([
|
||||
'*HOOK: test_runtest_logreport.py::test_a gw0*',
|
||||
'*HOOK: test_runtest_logreport.py::test_b gw0*',
|
||||
'*HOOK: test_runtest_logreport.py::test_c gw0*',
|
||||
'*3 passed*',
|
||||
])
|
||||
"""
|
||||
)
|
||||
res = testdir.runpytest("-n1", "-s")
|
||||
res.stdout.fnmatch_lines(
|
||||
[
|
||||
"*HOOK: test_runtest_logreport.py::test_a gw0*",
|
||||
"*HOOK: test_runtest_logreport.py::test_b gw0*",
|
||||
"*HOOK: test_runtest_logreport.py::test_c gw0*",
|
||||
"*3 passed*",
|
||||
]
|
||||
)
|
||||
|
||||
def test_node_collection_finished(self, testdir):
|
||||
"""Test pytest_xdist_node_collection_finished hook (#8).
|
||||
"""
|
||||
testdir.makeconftest("""
|
||||
testdir.makeconftest(
|
||||
"""
|
||||
def pytest_xdist_node_collection_finished(node, ids):
|
||||
workerid = node.workerinput['workerid']
|
||||
stripped_ids = [x.split('::')[1] for x in ids]
|
||||
print("HOOK: %s %s" % (workerid, ', '.join(stripped_ids)))
|
||||
""")
|
||||
res = testdir.runpytest('-n2', '-s')
|
||||
res.stdout.fnmatch_lines_random([
|
||||
'*HOOK: gw0 test_a, test_b, test_c',
|
||||
'*HOOK: gw1 test_a, test_b, test_c',
|
||||
])
|
||||
res.stdout.fnmatch_lines([
|
||||
'*3 passed*',
|
||||
])
|
||||
"""
|
||||
)
|
||||
res = testdir.runpytest("-n2", "-s")
|
||||
res.stdout.fnmatch_lines_random(
|
||||
["*HOOK: gw0 test_a, test_b, test_c", "*HOOK: gw1 test_a, test_b, test_c"]
|
||||
)
|
||||
res.stdout.fnmatch_lines(["*3 passed*"])
|
||||
|
||||
@@ -16,14 +16,15 @@ def test_dist_incompatibility_messages(testdir):
|
||||
|
||||
def test_dist_options(testdir):
|
||||
from xdist.plugin import pytest_cmdline_main as check_options
|
||||
|
||||
config = testdir.parseconfigure("-n 2")
|
||||
check_options(config)
|
||||
assert config.option.dist == "load"
|
||||
assert config.option.tx == ['popen'] * 2
|
||||
assert config.option.tx == ["popen"] * 2
|
||||
config = testdir.parseconfigure("--numprocesses", "2")
|
||||
check_options(config)
|
||||
assert config.option.dist == "load"
|
||||
assert config.option.tx == ['popen'] * 2
|
||||
assert config.option.tx == ["popen"] * 2
|
||||
config = testdir.parseconfigure("-d")
|
||||
check_options(config)
|
||||
assert config.option.dist == "load"
|
||||
@@ -31,28 +32,31 @@ def test_dist_options(testdir):
|
||||
|
||||
def test_auto_detect_cpus(testdir, monkeypatch):
|
||||
import os
|
||||
if hasattr(os, 'sched_getaffinity'):
|
||||
monkeypatch.setattr(os, 'sched_getaffinity', lambda _pid: set(range(99)))
|
||||
elif hasattr(os, 'cpu_count'):
|
||||
monkeypatch.setattr(os, 'cpu_count', lambda: 99)
|
||||
|
||||
if hasattr(os, "sched_getaffinity"):
|
||||
monkeypatch.setattr(os, "sched_getaffinity", lambda _pid: set(range(99)))
|
||||
elif hasattr(os, "cpu_count"):
|
||||
monkeypatch.setattr(os, "cpu_count", lambda: 99)
|
||||
else:
|
||||
import multiprocessing
|
||||
monkeypatch.setattr(multiprocessing, 'cpu_count', lambda: 99)
|
||||
|
||||
monkeypatch.setattr(multiprocessing, "cpu_count", lambda: 99)
|
||||
|
||||
config = testdir.parseconfigure("-n2")
|
||||
assert config.getoption('numprocesses') == 2
|
||||
assert config.getoption("numprocesses") == 2
|
||||
|
||||
config = testdir.parseconfigure("-nauto")
|
||||
assert config.getoption('numprocesses') == 99
|
||||
assert config.getoption("numprocesses") == 99
|
||||
|
||||
monkeypatch.delattr(os, 'sched_getaffinity', raising=False)
|
||||
monkeypatch.setenv('TRAVIS', 'true')
|
||||
monkeypatch.delattr(os, "sched_getaffinity", raising=False)
|
||||
monkeypatch.setenv("TRAVIS", "true")
|
||||
config = testdir.parseconfigure("-nauto")
|
||||
assert config.getoption('numprocesses') == 2
|
||||
assert config.getoption("numprocesses") == 2
|
||||
|
||||
|
||||
def test_boxed_with_collect_only(testdir):
|
||||
from xdist.plugin import pytest_cmdline_main as check_options
|
||||
|
||||
config = testdir.parseconfigure("-n1", "--boxed")
|
||||
check_options(config)
|
||||
assert config.option.forked
|
||||
@@ -92,13 +96,13 @@ class TestDistOptions:
|
||||
assert xspecs[1].ssh == "xyz"
|
||||
|
||||
def test_xspecs_multiplied(self, testdir):
|
||||
config = testdir.parseconfigure("--tx=3*popen", )
|
||||
config = testdir.parseconfigure("--tx=3*popen")
|
||||
xspecs = NodeManager(config)._getxspecs()
|
||||
assert len(xspecs) == 3
|
||||
assert xspecs[1].popen
|
||||
|
||||
def test_getrsyncdirs(self, testdir):
|
||||
config = testdir.parseconfigure('--rsyncdir=' + str(testdir.tmpdir))
|
||||
config = testdir.parseconfigure("--rsyncdir=" + str(testdir.tmpdir))
|
||||
nm = NodeManager(config, specs=[execnet.XSpec("popen")])
|
||||
assert not nm._getrsyncdirs()
|
||||
nm = NodeManager(config, specs=[execnet.XSpec("popen//chdir=qwe")])
|
||||
@@ -106,23 +110,24 @@ class TestDistOptions:
|
||||
assert testdir.tmpdir in nm.roots
|
||||
|
||||
def test_getrsyncignore(self, testdir):
|
||||
config = testdir.parseconfigure('--rsyncignore=fo*')
|
||||
config = testdir.parseconfigure("--rsyncignore=fo*")
|
||||
nm = NodeManager(config, specs=[execnet.XSpec("popen//chdir=qwe")])
|
||||
assert 'fo*' in nm.rsyncoptions['ignores']
|
||||
assert "fo*" in nm.rsyncoptions["ignores"]
|
||||
|
||||
def test_getrsyncdirs_with_conftest(self, testdir):
|
||||
p = py.path.local()
|
||||
for bn in 'x y z'.split():
|
||||
for bn in "x y z".split():
|
||||
p.mkdir(bn)
|
||||
testdir.makeini("""
|
||||
testdir.makeini(
|
||||
"""
|
||||
[pytest]
|
||||
rsyncdirs= x
|
||||
""")
|
||||
config = testdir.parseconfigure(
|
||||
testdir.tmpdir, '--rsyncdir=y', '--rsyncdir=z')
|
||||
"""
|
||||
)
|
||||
config = testdir.parseconfigure(testdir.tmpdir, "--rsyncdir=y", "--rsyncdir=z")
|
||||
nm = NodeManager(config, specs=[execnet.XSpec("popen//chdir=xyz")])
|
||||
roots = nm._getrsyncdirs()
|
||||
# assert len(roots) == 3 + 1 # pylib
|
||||
assert py.path.local('y') in roots
|
||||
assert py.path.local('z') in roots
|
||||
assert testdir.tmpdir.join('x') in roots
|
||||
assert py.path.local("y") in roots
|
||||
assert py.path.local("z") in roots
|
||||
assert testdir.tmpdir.join("x") in roots
|
||||
|
||||
@@ -35,7 +35,7 @@ class WorkerSetup:
|
||||
self.testdir = testdir
|
||||
self.events = Queue()
|
||||
|
||||
def setup(self, ):
|
||||
def setup(self,):
|
||||
self.testdir.chdir()
|
||||
# import os ; os.environ['EXECNET_DEBUG'] = "2"
|
||||
self.gateway = execnet.makegateway()
|
||||
@@ -45,8 +45,7 @@ class WorkerSetup:
|
||||
class DummyMananger:
|
||||
specs = [0, 1]
|
||||
|
||||
self.slp = WorkerController(DummyMananger, self.gateway, config,
|
||||
putevent)
|
||||
self.slp = WorkerController(DummyMananger, self.gateway, config, putevent)
|
||||
self.request.addfinalizer(self.slp.ensure_teardown)
|
||||
self.slp.setup()
|
||||
|
||||
@@ -59,7 +58,7 @@ class WorkerSetup:
|
||||
ev = EventCall(data)
|
||||
if name is None or ev.name == name:
|
||||
return ev
|
||||
print("skipping %s" % (ev, ))
|
||||
print("skipping %s" % (ev,))
|
||||
|
||||
def sendcommand(self, name, **kwargs):
|
||||
self.slp.sendcommand(name, **kwargs)
|
||||
@@ -70,9 +69,10 @@ def worker(request, testdir):
|
||||
return WorkerSetup(request, testdir)
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason='#59')
|
||||
@pytest.mark.xfail(reason="#59")
|
||||
def test_remoteinitconfig(testdir):
|
||||
from xdist.remote import remote_initconfig
|
||||
|
||||
config1 = testdir.parseconfig()
|
||||
config2 = remote_initconfig(config1.option.__dict__, config1.args)
|
||||
assert config2.option.__dict__ == config1.option.__dict__
|
||||
@@ -81,29 +81,33 @@ def test_remoteinitconfig(testdir):
|
||||
|
||||
class TestReportSerialization:
|
||||
def test_xdist_longrepr_to_str_issue_241(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import os
|
||||
def test_a(): assert False
|
||||
def test_b(): pass
|
||||
""")
|
||||
testdir.makeconftest("""
|
||||
"""
|
||||
)
|
||||
testdir.makeconftest(
|
||||
"""
|
||||
def pytest_runtest_logreport(report):
|
||||
print(report.longrepr)
|
||||
""")
|
||||
res = testdir.runpytest('-n1', '-s')
|
||||
res.stdout.fnmatch_lines([
|
||||
'*1 failed, 1 passed *'
|
||||
])
|
||||
"""
|
||||
)
|
||||
res = testdir.runpytest("-n1", "-s")
|
||||
res.stdout.fnmatch_lines(["*1 failed, 1 passed *"])
|
||||
|
||||
def test_xdist_report_longrepr_reprcrash_130(self, testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
reprec = testdir.inline_runsource(
|
||||
"""
|
||||
import py
|
||||
def test_fail(): assert False, 'Expected Message'
|
||||
""")
|
||||
"""
|
||||
)
|
||||
reports = reprec.getreports("pytest_runtest_logreport")
|
||||
assert len(reports) == 3
|
||||
rep = reports[1]
|
||||
added_section = ('Failure Metadata', str("metadata metadata"), "*")
|
||||
added_section = ("Failure Metadata", str("metadata metadata"), "*")
|
||||
rep.longrepr.sections.append(added_section)
|
||||
d = serialize_report(rep)
|
||||
check_marshallable(d)
|
||||
@@ -111,28 +115,31 @@ class TestReportSerialization:
|
||||
# Check assembled == rep
|
||||
assert a.__dict__.keys() == rep.__dict__.keys()
|
||||
for key in rep.__dict__.keys():
|
||||
if key != 'longrepr':
|
||||
if key != "longrepr":
|
||||
assert getattr(a, key) == getattr(rep, key)
|
||||
assert rep.longrepr.reprcrash.lineno == a.longrepr.reprcrash.lineno
|
||||
assert rep.longrepr.reprcrash.message == a.longrepr.reprcrash.message
|
||||
assert rep.longrepr.reprcrash.path == a.longrepr.reprcrash.path
|
||||
assert rep.longrepr.reprtraceback.entrysep \
|
||||
== a.longrepr.reprtraceback.entrysep
|
||||
assert rep.longrepr.reprtraceback.extraline \
|
||||
== a.longrepr.reprtraceback.extraline
|
||||
assert rep.longrepr.reprtraceback.style \
|
||||
== a.longrepr.reprtraceback.style
|
||||
assert rep.longrepr.reprtraceback.entrysep == a.longrepr.reprtraceback.entrysep
|
||||
assert (
|
||||
rep.longrepr.reprtraceback.extraline == a.longrepr.reprtraceback.extraline
|
||||
)
|
||||
assert rep.longrepr.reprtraceback.style == a.longrepr.reprtraceback.style
|
||||
assert rep.longrepr.sections == a.longrepr.sections
|
||||
# Missing section attribute PR171
|
||||
assert added_section in a.longrepr.sections
|
||||
|
||||
def test_reprentries_serialization_170(self, testdir):
|
||||
from _pytest._code.code import ReprEntry
|
||||
reprec = testdir.inline_runsource("""
|
||||
|
||||
reprec = testdir.inline_runsource(
|
||||
"""
|
||||
def test_repr_entry():
|
||||
x = 0
|
||||
assert x
|
||||
""", '--showlocals')
|
||||
""",
|
||||
"--showlocals",
|
||||
)
|
||||
reports = reprec.getreports("pytest_runtest_logreport")
|
||||
assert len(reports) == 3
|
||||
rep = reports[1]
|
||||
@@ -146,7 +153,9 @@ class TestReportSerialization:
|
||||
assert rep_entries[i].lines == a_entries[i].lines
|
||||
assert rep_entries[i].localssep == a_entries[i].localssep
|
||||
assert rep_entries[i].reprfileloc.lineno == a_entries[i].reprfileloc.lineno
|
||||
assert rep_entries[i].reprfileloc.message == a_entries[i].reprfileloc.message
|
||||
assert (
|
||||
rep_entries[i].reprfileloc.message == a_entries[i].reprfileloc.message
|
||||
)
|
||||
assert rep_entries[i].reprfileloc.path == a_entries[i].reprfileloc.path
|
||||
assert rep_entries[i].reprfuncargs.args == a_entries[i].reprfuncargs.args
|
||||
assert rep_entries[i].reprlocals.lines == a_entries[i].reprlocals.lines
|
||||
@@ -154,11 +163,15 @@ class TestReportSerialization:
|
||||
|
||||
def test_reprentries_serialization_196(self, testdir):
|
||||
from _pytest._code.code import ReprEntryNative
|
||||
reprec = testdir.inline_runsource("""
|
||||
|
||||
reprec = testdir.inline_runsource(
|
||||
"""
|
||||
def test_repr_entry_native():
|
||||
x = 0
|
||||
assert x
|
||||
""", '--tb=native')
|
||||
""",
|
||||
"--tb=native",
|
||||
)
|
||||
reports = reprec.getreports("pytest_runtest_logreport")
|
||||
assert len(reports) == 3
|
||||
rep = reports[1]
|
||||
@@ -172,7 +185,8 @@ class TestReportSerialization:
|
||||
assert rep_entries[i].lines == a_entries[i].lines
|
||||
|
||||
def test_itemreport_outcomes(self, testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
reprec = testdir.inline_runsource(
|
||||
"""
|
||||
import py
|
||||
def test_pass(): pass
|
||||
def test_fail(): 0/0
|
||||
@@ -184,7 +198,8 @@ class TestReportSerialization:
|
||||
def test_xfail(): 0/0
|
||||
def test_xfail_imperative():
|
||||
py.test.xfail("hello")
|
||||
""")
|
||||
"""
|
||||
)
|
||||
reports = reprec.getreports("pytest_runtest_logreport")
|
||||
assert len(reports) == 17 # with setup/teardown "passed" reports
|
||||
for rep in reports:
|
||||
@@ -246,10 +261,12 @@ class TestReportSerialization:
|
||||
|
||||
class TestWorkerInteractor:
|
||||
def test_basic_collect_and_runtests(self, worker):
|
||||
worker.testdir.makepyfile("""
|
||||
worker.testdir.makepyfile(
|
||||
"""
|
||||
def test_func():
|
||||
pass
|
||||
""")
|
||||
"""
|
||||
)
|
||||
worker.setup()
|
||||
ev = worker.popevent()
|
||||
assert ev.name == "workerready"
|
||||
@@ -257,8 +274,8 @@ class TestWorkerInteractor:
|
||||
assert ev.name == "collectionstart"
|
||||
assert not ev.kwargs
|
||||
ev = worker.popevent("collectionfinish")
|
||||
assert ev.kwargs['topdir'] == worker.testdir.tmpdir
|
||||
ids = ev.kwargs['ids']
|
||||
assert ev.kwargs["topdir"] == worker.testdir.tmpdir
|
||||
ids = ev.kwargs["ids"]
|
||||
assert len(ids) == 1
|
||||
worker.sendcommand("runtests", indices=list(range(len(ids))))
|
||||
worker.sendcommand("shutdown")
|
||||
@@ -268,20 +285,23 @@ class TestWorkerInteractor:
|
||||
ev = worker.popevent("testreport") # setup
|
||||
ev = worker.popevent("testreport")
|
||||
assert ev.name == "testreport"
|
||||
rep = unserialize_report(ev.name, ev.kwargs['data'])
|
||||
rep = unserialize_report(ev.name, ev.kwargs["data"])
|
||||
assert rep.nodeid.endswith("::test_func")
|
||||
assert rep.passed
|
||||
assert rep.when == "call"
|
||||
ev = worker.popevent("workerfinished")
|
||||
assert 'workeroutput' in ev.kwargs
|
||||
assert "workeroutput" in ev.kwargs
|
||||
|
||||
@pytest.mark.skipif(pytest.__version__ >= '3.0',
|
||||
reason='skip at module level illegal in pytest 3.0')
|
||||
@pytest.mark.skipif(
|
||||
pytest.__version__ >= "3.0", reason="skip at module level illegal in pytest 3.0"
|
||||
)
|
||||
def test_remote_collect_skip(self, worker):
|
||||
worker.testdir.makepyfile("""
|
||||
worker.testdir.makepyfile(
|
||||
"""
|
||||
import py
|
||||
py.test.skip("hello")
|
||||
""")
|
||||
"""
|
||||
)
|
||||
worker.setup()
|
||||
ev = worker.popevent("collectionstart")
|
||||
assert not ev.kwargs
|
||||
@@ -289,10 +309,10 @@ class TestWorkerInteractor:
|
||||
assert ev.name == "collectreport"
|
||||
ev = worker.popevent()
|
||||
assert ev.name == "collectreport"
|
||||
rep = unserialize_report(ev.name, ev.kwargs['data'])
|
||||
rep = unserialize_report(ev.name, ev.kwargs["data"])
|
||||
assert rep.skipped
|
||||
ev = worker.popevent("collectionfinish")
|
||||
assert not ev.kwargs['ids']
|
||||
assert not ev.kwargs["ids"]
|
||||
|
||||
def test_remote_collect_fail(self, worker):
|
||||
worker.testdir.makepyfile("""aasd qwe""")
|
||||
@@ -303,16 +323,18 @@ class TestWorkerInteractor:
|
||||
assert ev.name == "collectreport"
|
||||
ev = worker.popevent()
|
||||
assert ev.name == "collectreport"
|
||||
rep = unserialize_report(ev.name, ev.kwargs['data'])
|
||||
rep = unserialize_report(ev.name, ev.kwargs["data"])
|
||||
assert rep.failed
|
||||
ev = worker.popevent("collectionfinish")
|
||||
assert not ev.kwargs['ids']
|
||||
assert not ev.kwargs["ids"]
|
||||
|
||||
def test_runtests_all(self, worker):
|
||||
worker.testdir.makepyfile("""
|
||||
worker.testdir.makepyfile(
|
||||
"""
|
||||
def test_func(): pass
|
||||
def test_func2(): pass
|
||||
""")
|
||||
"""
|
||||
)
|
||||
worker.setup()
|
||||
ev = worker.popevent()
|
||||
assert ev.name == "workerready"
|
||||
@@ -320,57 +342,63 @@ class TestWorkerInteractor:
|
||||
assert ev.name == "collectionstart"
|
||||
assert not ev.kwargs
|
||||
ev = worker.popevent("collectionfinish")
|
||||
ids = ev.kwargs['ids']
|
||||
ids = ev.kwargs["ids"]
|
||||
assert len(ids) == 2
|
||||
worker.sendcommand("runtests_all", )
|
||||
worker.sendcommand("shutdown", )
|
||||
worker.sendcommand("runtests_all")
|
||||
worker.sendcommand("shutdown")
|
||||
for func in "::test_func", "::test_func2":
|
||||
for i in range(3): # setup/call/teardown
|
||||
ev = worker.popevent("testreport")
|
||||
assert ev.name == "testreport"
|
||||
rep = unserialize_report(ev.name, ev.kwargs['data'])
|
||||
rep = unserialize_report(ev.name, ev.kwargs["data"])
|
||||
assert rep.nodeid.endswith(func)
|
||||
ev = worker.popevent("workerfinished")
|
||||
assert 'workeroutput' in ev.kwargs
|
||||
assert "workeroutput" in ev.kwargs
|
||||
|
||||
def test_happy_run_events_converted(self, testdir, worker):
|
||||
py.test.xfail("implement a simple test for event production")
|
||||
assert not worker.use_callback
|
||||
worker.testdir.makepyfile("""
|
||||
worker.testdir.makepyfile(
|
||||
"""
|
||||
def test_func():
|
||||
pass
|
||||
""")
|
||||
"""
|
||||
)
|
||||
worker.setup()
|
||||
hookrec = testdir.getreportrecorder(worker.config)
|
||||
for data in worker.slp.channel:
|
||||
worker.slp.process_from_remote(data)
|
||||
worker.slp.process_from_remote(worker.slp.ENDMARK)
|
||||
pprint.pprint(hookrec.hookrecorder.calls)
|
||||
hookrec.hookrecorder.contains([
|
||||
("pytest_collectstart", "collector.fspath == aaa"),
|
||||
("pytest_pycollect_makeitem", "name == 'test_func'"),
|
||||
("pytest_collectreport", "report.collector.fspath == aaa"),
|
||||
("pytest_collectstart", "collector.fspath == bbb"),
|
||||
("pytest_pycollect_makeitem", "name == 'test_func'"),
|
||||
("pytest_collectreport", "report.collector.fspath == bbb"),
|
||||
])
|
||||
hookrec.hookrecorder.contains(
|
||||
[
|
||||
("pytest_collectstart", "collector.fspath == aaa"),
|
||||
("pytest_pycollect_makeitem", "name == 'test_func'"),
|
||||
("pytest_collectreport", "report.collector.fspath == aaa"),
|
||||
("pytest_collectstart", "collector.fspath == bbb"),
|
||||
("pytest_pycollect_makeitem", "name == 'test_func'"),
|
||||
("pytest_collectreport", "report.collector.fspath == bbb"),
|
||||
]
|
||||
)
|
||||
|
||||
def test_process_from_remote_error_handling(self, worker, capsys):
|
||||
worker.use_callback = True
|
||||
worker.setup()
|
||||
worker.slp.process_from_remote(('<nonono>', ()))
|
||||
worker.slp.process_from_remote(("<nonono>", ()))
|
||||
out, err = capsys.readouterr()
|
||||
assert 'INTERNALERROR> ValueError: unknown event: <nonono>' in out
|
||||
assert "INTERNALERROR> ValueError: unknown event: <nonono>" in out
|
||||
ev = worker.popevent()
|
||||
assert ev.name == "errordown"
|
||||
|
||||
|
||||
def test_remote_env_vars(testdir):
|
||||
testdir.makepyfile('''
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import os
|
||||
def test():
|
||||
assert os.environ['PYTEST_XDIST_WORKER'] in ('gw0', 'gw1')
|
||||
assert os.environ['PYTEST_XDIST_WORKER_COUNT'] == '2'
|
||||
''')
|
||||
result = testdir.runpytest('-n2', '--max-worker-restart=0')
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest("-n2", "--max-worker-restart=0")
|
||||
assert result.ret == 0
|
||||
|
||||
@@ -42,7 +42,7 @@ def workercontroller(monkeypatch):
|
||||
def setup(self):
|
||||
pass
|
||||
|
||||
monkeypatch.setattr(workermanage, 'WorkerController', MockController)
|
||||
monkeypatch.setattr(workermanage, "WorkerController", MockController)
|
||||
return MockController
|
||||
|
||||
|
||||
@@ -58,8 +58,7 @@ class TestNodeManagerPopen:
|
||||
for spec in NodeManager(config, specs, defaultchdir="abc").specs:
|
||||
assert spec.chdir == "abc"
|
||||
|
||||
def test_popen_makegateway_events(self, config, hookrecorder,
|
||||
workercontroller):
|
||||
def test_popen_makegateway_events(self, config, hookrecorder, workercontroller):
|
||||
hm = NodeManager(config, ["popen"] * 2)
|
||||
hm.setup_nodes(None)
|
||||
call = hookrecorder.popcall("pytest_xdist_setupnodes")
|
||||
@@ -108,15 +107,16 @@ class TestNodeManagerPopen:
|
||||
for gw in hm.group:
|
||||
hm.rsync(gw, source, notify=lambda *args: notifications.append(args))
|
||||
assert len(notifications) == 1
|
||||
assert notifications[0] == ("rsyncrootready", hm.group['gw0'].spec, source)
|
||||
assert notifications[0] == ("rsyncrootready", hm.group["gw0"].spec, source)
|
||||
hm.teardown_nodes()
|
||||
dest = dest.join(source.basename)
|
||||
assert dest.join("dir1").check()
|
||||
assert dest.join("dir1", "dir2").check()
|
||||
assert dest.join("dir1", "dir2", 'hello').check()
|
||||
assert dest.join("dir1", "dir2", "hello").check()
|
||||
|
||||
def test_rsync_same_popen_twice(self, config, mysetup, hookrecorder,
|
||||
workercontroller):
|
||||
def test_rsync_same_popen_twice(
|
||||
self, config, mysetup, hookrecorder, workercontroller
|
||||
):
|
||||
source, dest = mysetup.source, mysetup.dest
|
||||
hm = NodeManager(config, ["popen//chdir=%s" % dest] * 2)
|
||||
hm.roots = []
|
||||
@@ -142,9 +142,9 @@ class TestHRSync:
|
||||
files = list(source.visit(rec=syncer.filter, fil=syncer.filter))
|
||||
assert len(files) == 3
|
||||
basenames = [x.basename for x in files]
|
||||
assert 'dir' in basenames
|
||||
assert 'file.txt' in basenames
|
||||
assert 'somedir' in basenames
|
||||
assert "dir" in basenames
|
||||
assert "file.txt" in basenames
|
||||
assert "somedir" in basenames
|
||||
|
||||
def test_hrsync_one_host(self, mysetup):
|
||||
source, dest = mysetup.source, mysetup.dest
|
||||
@@ -169,7 +169,8 @@ class TestNodeManager:
|
||||
nodemanager.makegateways()
|
||||
nodemanager.rsync_roots()
|
||||
p, = nodemanager.gwmanager.multi_exec(
|
||||
"import os ; channel.send(os.getcwd())").receive_each()
|
||||
"import os ; channel.send(os.getcwd())"
|
||||
).receive_each()
|
||||
p = py.path.local(p)
|
||||
print("remote curdir", p)
|
||||
assert p == mysetup.dest.join(config.topdir.basename)
|
||||
@@ -183,15 +184,17 @@ class TestNodeManager:
|
||||
dir2.ensure("hello")
|
||||
for rsyncroot in (dir1, source):
|
||||
dest.remove()
|
||||
nodemanager = NodeManager(testdir.parseconfig(
|
||||
"--tx", "popen//chdir=%s" % dest, "--rsyncdir", rsyncroot,
|
||||
source, ))
|
||||
nodemanager = NodeManager(
|
||||
testdir.parseconfig(
|
||||
"--tx", "popen//chdir=%s" % dest, "--rsyncdir", rsyncroot, source
|
||||
)
|
||||
)
|
||||
nodemanager.setup_nodes(None) # calls .rsync_roots()
|
||||
if rsyncroot == source:
|
||||
dest = dest.join("source")
|
||||
assert dest.join("dir1").check()
|
||||
assert dest.join("dir1", "dir2").check()
|
||||
assert dest.join("dir1", "dir2", 'hello').check()
|
||||
assert dest.join("dir1", "dir2", "hello").check()
|
||||
nodemanager.teardown_nodes()
|
||||
|
||||
def test_init_rsync_roots(self, testdir, mysetup, workercontroller):
|
||||
@@ -200,10 +203,14 @@ class TestNodeManager:
|
||||
source.ensure("dir1", "somefile", dir=1)
|
||||
dir2.ensure("hello")
|
||||
source.ensure("bogusdir", "file")
|
||||
source.join("tox.ini").write(textwrap.dedent("""
|
||||
source.join("tox.ini").write(
|
||||
textwrap.dedent(
|
||||
"""
|
||||
[pytest]
|
||||
rsyncdirs=dir1/dir2
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
config = testdir.parseconfig(source)
|
||||
nodemanager = NodeManager(config, ["popen//chdir=%s" % dest])
|
||||
nodemanager.setup_nodes(None) # calls .rsync_roots()
|
||||
@@ -219,27 +226,31 @@ class TestNodeManager:
|
||||
dir2.ensure("hello")
|
||||
source.ensure("foo", "bar")
|
||||
source.ensure("bar", "foo")
|
||||
source.join("tox.ini").write(textwrap.dedent("""
|
||||
source.join("tox.ini").write(
|
||||
textwrap.dedent(
|
||||
"""
|
||||
[pytest]
|
||||
rsyncdirs = dir1 dir5
|
||||
rsyncignore = dir1/dir2 dir5/dir6 foo*
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
config = testdir.parseconfig(source)
|
||||
config.option.rsyncignore = ['bar']
|
||||
config.option.rsyncignore = ["bar"]
|
||||
nodemanager = NodeManager(config, ["popen//chdir=%s" % dest])
|
||||
nodemanager.setup_nodes(None) # calls .rsync_roots()
|
||||
assert dest.join("dir1").check()
|
||||
assert not dest.join("dir1", "dir2").check()
|
||||
assert dest.join("dir5", "file").check()
|
||||
assert not dest.join("dir6").check()
|
||||
assert not dest.join('foo').check()
|
||||
assert not dest.join('bar').check()
|
||||
assert not dest.join("foo").check()
|
||||
assert not dest.join("bar").check()
|
||||
|
||||
def test_optimise_popen(self, testdir, mysetup, workercontroller):
|
||||
source = mysetup.source
|
||||
specs = ["popen"] * 3
|
||||
source.join("conftest.py").write("rsyncdirs = ['a']")
|
||||
source.ensure('a', dir=1)
|
||||
source.ensure("a", dir=1)
|
||||
config = testdir.parseconfig(source)
|
||||
nodemanager = NodeManager(config, specs)
|
||||
nodemanager.setup_nodes(None) # calls .rysnc_roots()
|
||||
@@ -248,12 +259,15 @@ class TestNodeManager:
|
||||
assert not gwspec.chdir
|
||||
|
||||
def test_ssh_setup_nodes(self, specssh, testdir):
|
||||
testdir.makepyfile(__init__="",
|
||||
test_x="""
|
||||
testdir.makepyfile(
|
||||
__init__="",
|
||||
test_x="""
|
||||
def test_one():
|
||||
pass
|
||||
""")
|
||||
reprec = testdir.inline_run("-d", "--rsyncdir=%s" % testdir.tmpdir,
|
||||
"--tx", specssh, testdir.tmpdir)
|
||||
""",
|
||||
)
|
||||
reprec = testdir.inline_run(
|
||||
"-d", "--rsyncdir=%s" % testdir.tmpdir, "--tx", specssh, testdir.tmpdir
|
||||
)
|
||||
rep, = reprec.getreports("pytest_runtest_logreport")
|
||||
assert rep.passed
|
||||
|
||||
Reference in New Issue
Block a user