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.ns_aware
parent
82d02ef404
commit
7b89204afd
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue