fixes issue79 - call hooks more systematically on slave nodes and also in the case of SIGINT
reorganize internal session code to share more code with the "normal" non-distributed session
This commit is contained in:
@@ -152,3 +152,23 @@ class TestDistribution:
|
||||
"*1 passed*"
|
||||
])
|
||||
assert result.ret == 0
|
||||
|
||||
def test_keyboardinterrupt_hooks_issue79(self, testdir):
|
||||
testdir.makepyfile(__init__="", test_one="""
|
||||
def test_hello():
|
||||
raise KeyboardInterrupt()
|
||||
""")
|
||||
testdir.makeconftest("""
|
||||
def pytest_sessionfinish(session):
|
||||
if hasattr(session.config, 'slaveoutput'):
|
||||
session.config.slaveoutput['s2'] = 42
|
||||
def pytest_testnodedown(node, error):
|
||||
assert node.slaveoutput['s2'] == 42
|
||||
print "s2call-finished"
|
||||
""")
|
||||
args = ["-n1"]
|
||||
result = testdir.runpytest(*args)
|
||||
s = result.stdout.str()
|
||||
assert result.ret
|
||||
assert 'SIGINT' in s
|
||||
assert 's2call' in s
|
||||
|
||||
@@ -81,7 +81,7 @@ class TestMasterSlaveConnection:
|
||||
node.send(123) # invalid item
|
||||
kwargs = mysetup.geteventargs("pytest_testnodedown")
|
||||
assert kwargs['node'] is node
|
||||
assert isinstance(kwargs['error'], execnet.RemoteError)
|
||||
#assert isinstance(kwargs['error'], execnet.RemoteError)
|
||||
|
||||
def test_crash_killed(self, testdir, mysetup):
|
||||
if not hasattr(py.std.os, 'kill'):
|
||||
|
||||
Reference in New Issue
Block a user