forked from goodboy/tractor
Add pattern matching to test
parent
79c38b04e7
commit
a88a6ba7a3
|
@ -334,13 +334,30 @@ def test_multi_nested_subactors_error_through_nurseries(spawn):
|
||||||
|
|
||||||
|
|
||||||
def test_root_nursery_cancels_before_child_releases_tty_lock(spawn):
|
def test_root_nursery_cancels_before_child_releases_tty_lock(spawn):
|
||||||
"""Exemplifies a bug where the root sends a cancel message before a nested child
|
"""Test that when the root sends a cancel message before a nested
|
||||||
which has the tty lock (and is in pdb) doesn't cancel after exiting the debugger.
|
child has unblocked (which can happen when it has the tty lock and
|
||||||
|
is engaged in pdb) it is indeed cancelled after exiting the debugger.
|
||||||
"""
|
"""
|
||||||
child = spawn('root_cancelled_but_child_is_in_tty_lock')
|
child = spawn('root_cancelled_but_child_is_in_tty_lock')
|
||||||
|
|
||||||
for _ in range(5):
|
|
||||||
child.expect(r"\(Pdb\+\+\)")
|
child.expect(r"\(Pdb\+\+\)")
|
||||||
|
|
||||||
|
before = str(child.before.decode())
|
||||||
|
assert "NameError: name 'doggypants' is not defined" in before
|
||||||
|
assert "tractor._exceptions.RemoteActorError: ('name_error'" not in before
|
||||||
child.sendline('c')
|
child.sendline('c')
|
||||||
|
|
||||||
# child.expect(pexpect.EOF)
|
for _ in range(4):
|
||||||
|
child.expect(r"\(Pdb\+\+\)")
|
||||||
|
|
||||||
|
before = str(child.before.decode())
|
||||||
|
assert "NameError: name 'doggypants' is not defined" in before
|
||||||
|
|
||||||
|
child.sendline('c')
|
||||||
|
|
||||||
|
|
||||||
|
child.expect(pexpect.EOF)
|
||||||
|
before = str(child.before.decode())
|
||||||
|
assert "tractor._exceptions.RemoteActorError: ('spawner0'" in before
|
||||||
|
assert "tractor._exceptions.RemoteActorError: ('name_error'" in before
|
||||||
|
assert "NameError: name 'doggypants' is not defined" in before
|
||||||
|
|
Loading…
Reference in New Issue