From 9c9309faf86757af7deb08b6cf5205b4652a52e5 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 4 Jul 2021 10:25:41 -0400 Subject: [PATCH] Handle race for tty by child actors --- tests/test_debugger.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/test_debugger.py b/tests/test_debugger.py index 8f850df..f7d0097 100644 --- a/tests/test_debugger.py +++ b/tests/test_debugger.py @@ -297,15 +297,30 @@ def test_multi_daemon_subactors(spawn, loglevel): child.expect(r"\(Pdb\+\+\)") + # there is a race for which subactor will acquire + # the root's tty lock first + before = str(child.before.decode()) - assert "Attaching pdb to actor: ('bp_forever'" in before + + bp_forever_msg = "Attaching pdb to actor: ('bp_forever'" + name_error_msg = "NameError" + + if bp_forever_msg in before: + next_msg = name_error_msg + + elif name_error_msg in before: + next_msg = bp_forever_msg + + else: + raise ValueError("Neither log msg was found !?") child.sendline('c') # first name_error failure child.expect(r"\(Pdb\+\+\)") before = str(child.before.decode()) - assert "NameError" in before + + assert next_msg in before child.sendline('c')