Better early timeout handling, continue on child re-lock

debugger_test_tweaks
Tyler Goodlet 2021-08-01 13:10:51 -04:00
parent b01f594025
commit c5c7e694ec
1 changed files with 8 additions and 12 deletions

View File

@ -422,27 +422,22 @@ def test_multi_nested_subactors_error_through_nurseries(spawn):
child = spawn('multi_nested_subactors_error_up_through_nurseries') child = spawn('multi_nested_subactors_error_up_through_nurseries')
timed_out_early: bool = False
for i in range(12): for i in range(12):
try: try:
child.expect(r"\(Pdb\+\+\)") child.expect(r"\(Pdb\+\+\)")
child.sendline('c') child.sendline('c')
time.sleep(0.1) time.sleep(0.1)
except ( except pexpect.exceptions.EOF:
pexpect.exceptions.EOF,
pexpect.exceptions.TIMEOUT,
):
# races all over..
print(f"Failed early on {i}?")
before = str(child.before.decode())
timed_out_early = True
# race conditions on how fast the continue is sent? # race conditions on how fast the continue is sent?
print(f"Failed early on {i}?")
timed_out_early = True
break break
else:
child.expect(pexpect.EOF) child.expect(pexpect.EOF)
if not timed_out_early: if not timed_out_early:
before = str(child.before.decode()) before = str(child.before.decode())
@ -499,6 +494,7 @@ def test_root_nursery_cancels_before_child_releases_tty_lock(
child.expect(pexpect.EOF) child.expect(pexpect.EOF)
break break
except pexpect.exceptions.TIMEOUT: except pexpect.exceptions.TIMEOUT:
child.sendline('c')
print('child was able to grab tty lock again?') print('child was able to grab tty lock again?')
if not timed_out_early: if not timed_out_early: