forked from goodboy/tractor
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).signint_saviour
parent
b01daa5319
commit
a4538a3d84
|
@ -10,10 +10,11 @@ TODO:
|
||||||
- wonder if any of it'll work on OS X?
|
- wonder if any of it'll work on OS X?
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import time
|
|
||||||
from os import path
|
from os import path
|
||||||
import platform
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import pexpect
|
import pexpect
|
||||||
|
@ -94,7 +95,22 @@ def assert_before(
|
||||||
ids='ctl-c={}'.format,
|
ids='ctl-c={}'.format,
|
||||||
)
|
)
|
||||||
def ctlc(request) -> bool:
|
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(
|
@pytest.mark.parametrize(
|
||||||
|
@ -169,7 +185,7 @@ def do_ctlc(
|
||||||
|
|
||||||
# XXX: literally no idea why this is an issue in CI but likely will
|
# XXX: literally no idea why this is an issue in CI but likely will
|
||||||
# flush out (hopefully) with proper 3.10 release of `pdbpp`...
|
# flush out (hopefully) with proper 3.10 release of `pdbpp`...
|
||||||
expect_prompt: bool = False,
|
expect_prompt: bool = True,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
|
@ -178,12 +194,11 @@ def do_ctlc(
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
child.sendcontrol('c')
|
child.sendcontrol('c')
|
||||||
|
|
||||||
# before = str(child.before.decode())
|
|
||||||
|
|
||||||
# TODO: figure out why this makes CI fail..
|
# TODO: figure out why this makes CI fail..
|
||||||
# if you run this test manually it works just fine..
|
# if you run this test manually it works just fine..
|
||||||
from conftest import _ci_env
|
from conftest import _ci_env
|
||||||
if expect_prompt and not _ci_env:
|
if expect_prompt and not _ci_env:
|
||||||
|
before = str(child.before.decode())
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
child.expect(r"\(Pdb\+\+\)")
|
child.expect(r"\(Pdb\+\+\)")
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
|
@ -235,9 +250,15 @@ def test_root_actor_bp_forever(
|
||||||
child.expect(pexpect.EOF)
|
child.expect(pexpect.EOF)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'do_next',
|
||||||
|
(True, False),
|
||||||
|
ids='do_next={}'.format,
|
||||||
|
)
|
||||||
def test_subactor_error(
|
def test_subactor_error(
|
||||||
spawn,
|
spawn,
|
||||||
ctlc: bool,
|
ctlc: bool,
|
||||||
|
do_next: bool,
|
||||||
):
|
):
|
||||||
"Single subactor raising an error"
|
"Single subactor raising an error"
|
||||||
|
|
||||||
|
@ -249,17 +270,21 @@ def test_subactor_error(
|
||||||
before = str(child.before.decode())
|
before = str(child.before.decode())
|
||||||
assert "Attaching to pdb in crashed actor: ('name_error'" in before
|
assert "Attaching to pdb in crashed actor: ('name_error'" in before
|
||||||
|
|
||||||
|
if do_next:
|
||||||
|
child.sendline('n')
|
||||||
|
|
||||||
|
else:
|
||||||
# make sure ctl-c sends don't do anything but repeat output
|
# make sure ctl-c sends don't do anything but repeat output
|
||||||
if ctlc:
|
if ctlc:
|
||||||
do_ctlc(
|
do_ctlc(
|
||||||
child,
|
child,
|
||||||
)
|
)
|
||||||
|
|
||||||
child.expect(r"\(Pdb\+\+\)")
|
|
||||||
# send user command and (in this case it's the same for 'continue'
|
# 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
|
# vs. 'quit') the debugger should enter a second time in the nursery
|
||||||
# creating actor
|
# creating actor
|
||||||
child.sendline('continue')
|
child.sendline('continue')
|
||||||
|
|
||||||
child.expect(r"\(Pdb\+\+\)")
|
child.expect(r"\(Pdb\+\+\)")
|
||||||
before = str(child.before.decode())
|
before = str(child.before.decode())
|
||||||
|
|
||||||
|
@ -578,7 +603,6 @@ def test_multi_subactors_root_errors(
|
||||||
|
|
||||||
if ctlc:
|
if ctlc:
|
||||||
do_ctlc(child)
|
do_ctlc(child)
|
||||||
child.expect(r"\(Pdb\+\+\)")
|
|
||||||
|
|
||||||
child.sendline('c')
|
child.sendline('c')
|
||||||
child.expect(r"\(Pdb\+\+\)")
|
child.expect(r"\(Pdb\+\+\)")
|
||||||
|
|
Loading…
Reference in New Issue