From 7b89204afdf32710ce21486f148c7bcd5a14bd90 Mon Sep 17 00:00:00 2001 From: goodboy Date: Sun, 1 Mar 2026 23:32:36 -0500 Subject: [PATCH] Tweak `do_ctlc()`'s `delay` default To be a null default and set to `0.1` when not passed by the caller so as to avoid having to pass `0.1` if you wanted the param-defined-default. Also, - in the `spawn()` fixtures's `unset_colors()` closure, add in a masked `os.environ['NO_COLOR'] = '1'` since i found it while trying to debug debugger tests. - always return the `child.before` content from `assert_before()` helper; again it comes in handy when debugging console matching tests. --- tests/devx/conftest.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/devx/conftest.py b/tests/devx/conftest.py index efc74d44..b7559706 100644 --- a/tests/devx/conftest.py +++ b/tests/devx/conftest.py @@ -68,7 +68,10 @@ def spawn( ''' import os + # disable colored tbs os.environ['PYTHON_COLORS'] = '0' + # disable all ANSI color output + # os.environ['NO_COLOR'] = '1' spawned: PexpectSpawner|None = None @@ -251,12 +254,13 @@ def assert_before( err_on_false=True, **kwargs ) + return str(child.before.decode()) def do_ctlc( child, count: int = 3, - delay: float = 0.1, + delay: float|None = None, patt: str|None = None, # expect repl UX to reprint the prompt after every @@ -268,6 +272,7 @@ def do_ctlc( ) -> str|None: before: str|None = None + delay = delay or 0.1 # make sure ctl-c sends don't do anything but repeat output for _ in range(count): @@ -278,7 +283,10 @@ def do_ctlc( # if you run this test manually it works just fine.. if expect_prompt: time.sleep(delay) - child.expect(PROMPT) + child.expect( + PROMPT, + # timeout=1, # TODO? if needed + ) before = str(child.before.decode()) time.sleep(delay)