From c5c7e694ecfa44a3205daeb9c80684ecca38472f Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 1 Aug 2021 13:10:51 -0400 Subject: [PATCH] Better early timeout handling, continue on child re-lock --- tests/test_debugger.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/test_debugger.py b/tests/test_debugger.py index a3eb040..87bce1b 100644 --- a/tests/test_debugger.py +++ b/tests/test_debugger.py @@ -422,27 +422,22 @@ def test_multi_nested_subactors_error_through_nurseries(spawn): child = spawn('multi_nested_subactors_error_up_through_nurseries') + timed_out_early: bool = False + for i in range(12): try: child.expect(r"\(Pdb\+\+\)") child.sendline('c') time.sleep(0.1) - except ( - pexpect.exceptions.EOF, - pexpect.exceptions.TIMEOUT, - ): - # races all over.. - - print(f"Failed early on {i}?") - before = str(child.before.decode()) - - timed_out_early = True + except pexpect.exceptions.EOF: # race conditions on how fast the continue is sent? + print(f"Failed early on {i}?") + timed_out_early = True break - - child.expect(pexpect.EOF) + else: + child.expect(pexpect.EOF) if not timed_out_early: before = str(child.before.decode()) @@ -499,6 +494,7 @@ def test_root_nursery_cancels_before_child_releases_tty_lock( child.expect(pexpect.EOF) break except pexpect.exceptions.TIMEOUT: + child.sendline('c') print('child was able to grab tty lock again?') if not timed_out_early: