diff --git a/tests/devx/test_debugger.py b/tests/devx/test_debugger.py index d3f9fa5d..f415f6c1 100644 --- a/tests/devx/test_debugger.py +++ b/tests/devx/test_debugger.py @@ -51,13 +51,14 @@ if TYPE_CHECKING: # - recurrent root errors +_non_linux: bool = platform.system() != 'Linux' + if platform.system() == 'Windows': pytest.skip( 'Debugger tests have no windows support (yet)', allow_module_level=True, ) - # TODO: was trying to this xfail style but some weird bug i see in CI # that's happening at collect time.. pretty soon gonna dump actions i'm # thinkin... @@ -480,8 +481,24 @@ def test_multi_daemon_subactors( stream. ''' - child = spawn('multi_daemon_subactors') + non_linux = _non_linux + if non_linux and ctlc: + pytest.skip( + 'Ctl-c + MacOS is too unreliable/racy for this test..\n' + ) + # !TODO, if someone with more patience then i wants to muck + # with the timings on this please feel free to see all the + # `non_linux` branching logic i added on my first attempt + # below! + # + # my conclusion was that if i were to run the script + # manually, and thus as slowly as a human would, the test + # would and should pass as described in this test fn, however + # after fighting with it for >= 1hr. i decided more then + # likely the more extensive `linux` testing should cover most + # regressions. + child = spawn('multi_daemon_subactors') child.expect(PROMPT) # there can be a race for which subactor will acquire @@ -511,8 +528,19 @@ def test_multi_daemon_subactors( else: raise ValueError('Neither log msg was found !?') + non_linux_delay: float = 0.3 if ctlc: - do_ctlc(child) + do_ctlc( + child, + delay=( + non_linux_delay + if non_linux + else None + ), + ) + + if non_linux: + time.sleep(1) # NOTE: previously since we did not have clobber prevention # in the root actor this final resume could result in the debugger @@ -543,33 +571,66 @@ def test_multi_daemon_subactors( # assert "in use by child ('bp_forever'," in before if ctlc: - do_ctlc(child) + do_ctlc( + child, + delay=( + non_linux_delay + if non_linux + else None + ), + ) + + if non_linux: + time.sleep(1) # expect another breakpoint actor entry child.sendline('c') child.expect(PROMPT) - try: - assert_before( + before: str = assert_before( child, bp_forev_parts, ) except AssertionError: - assert_before( + before: str = assert_before( child, name_error_parts, ) else: if ctlc: - do_ctlc(child) + before: str = do_ctlc( + child, + delay=( + non_linux_delay + if non_linux + else None + ), + ) + + if non_linux: + time.sleep(1) # should crash with the 2nd name error (simulates # a retry) and then the root eventually (boxed) errors # after 1 or more further bp actor entries. child.sendline('c') - child.expect(PROMPT) + try: + child.expect( + PROMPT, + timeout=3, + ) + except EOF: + before: str = child.before.decode() + print( + f'\n' + f'??? NEVER RXED `pdb` PROMPT ???\n' + f'\n' + f'{before}\n' + ) + raise + assert_before( child, name_error_parts, @@ -1133,14 +1194,20 @@ def test_ctxep_pauses_n_maybe_ipc_breaks( # closed so verify we see error reporting as well as # a failed crash-REPL request msg and can CTL-c our way # out. + + # ?TODO, match depending on `tpt_proto(s)`? + # - [ ] how can we pass it into the script tho? + tpt: str = 'UDS' + if _non_linux: + tpt: str = 'TCP' + assert_before( child, ['peer IPC channel closed abruptly?', 'another task closed this fd', 'Debug lock request was CANCELLED?', - "'MsgpackUDSStream' was already closed locally?", - "TransportClosed: 'MsgpackUDSStream' was already closed 'by peer'?", - # ?TODO^? match depending on `tpt_proto(s)`? + f"'Msgpack{tpt}Stream' was already closed locally?", + f"TransportClosed: 'Msgpack{tpt}Stream' was already closed 'by peer'?", ] # XXX races on whether these show/hit?