From a4538a3d84e26df577f5471cdf4955163a143fc9 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 28 Jul 2022 14:04:30 -0400 Subject: [PATCH] Drop ctlc tests on Py3.9... After many tries I just don't think it's worth it to make the tests work since the repl UX in `pdbpp` is so unreliable in the latest release and honestly we're trying to go 3.10+ ASAP. Further, - entirely drop the pattern matching inside the `do_ctlc()` for now. - add a `subactor_error` parametrization that catches a case that previously caused a hang (when you use 'next' immediately after the first crash/debug lock (the fix was pushed just before this commit). --- tests/test_debugger.py | 58 +++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/tests/test_debugger.py b/tests/test_debugger.py index f0baa07..5ede0a2 100644 --- a/tests/test_debugger.py +++ b/tests/test_debugger.py @@ -10,10 +10,11 @@ TODO: - wonder if any of it'll work on OS X? """ -import time from os import path -import platform from typing import Optional +import platform +import sys +import time import pytest import pexpect @@ -94,7 +95,22 @@ def assert_before( ids='ctl-c={}'.format, ) def ctlc(request) -> bool: - yield request.param + + use_ctlc = request.param + + if ( + sys.version_info <= (3, 10) + and use_ctlc + ): + # on 3.9 it seems the REPL UX + # is highly unreliable and frankly annoying + # to test for. It does work from manual testing + # but i just don't think it's wroth it to try + # and get this working especially since we want to + # be 3.10+ mega-asap. + pytest.skip('Py3.9 and `pdbpp` son no bueno..') + + yield use_ctlc @pytest.mark.parametrize( @@ -169,7 +185,7 @@ def do_ctlc( # XXX: literally no idea why this is an issue in CI but likely will # flush out (hopefully) with proper 3.10 release of `pdbpp`... - expect_prompt: bool = False, + expect_prompt: bool = True, ) -> None: @@ -178,12 +194,11 @@ def do_ctlc( time.sleep(delay) child.sendcontrol('c') - # before = str(child.before.decode()) - # TODO: figure out why this makes CI fail.. # if you run this test manually it works just fine.. from conftest import _ci_env if expect_prompt and not _ci_env: + before = str(child.before.decode()) time.sleep(delay) child.expect(r"\(Pdb\+\+\)") time.sleep(delay) @@ -235,9 +250,15 @@ def test_root_actor_bp_forever( child.expect(pexpect.EOF) +@pytest.mark.parametrize( + 'do_next', + (True, False), + ids='do_next={}'.format, +) def test_subactor_error( spawn, ctlc: bool, + do_next: bool, ): "Single subactor raising an error" @@ -249,17 +270,21 @@ def test_subactor_error( before = str(child.before.decode()) assert "Attaching to pdb in crashed actor: ('name_error'" in before - # make sure ctl-c sends don't do anything but repeat output - if ctlc: - do_ctlc( - child, - ) + if do_next: + child.sendline('n') + + else: + # make sure ctl-c sends don't do anything but repeat output + if ctlc: + do_ctlc( + child, + ) + + # send user command and (in this case it's the same for 'continue' + # vs. 'quit') the debugger should enter a second time in the nursery + # creating actor + child.sendline('continue') - child.expect(r"\(Pdb\+\+\)") - # send user command and (in this case it's the same for 'continue' - # vs. 'quit') the debugger should enter a second time in the nursery - # creating actor - child.sendline('continue') child.expect(r"\(Pdb\+\+\)") before = str(child.before.decode()) @@ -578,7 +603,6 @@ def test_multi_subactors_root_errors( if ctlc: do_ctlc(child) - child.expect(r"\(Pdb\+\+\)") child.sendline('c') child.expect(r"\(Pdb\+\+\)")