cmdtest.py: new --dev-mode option

This commit is contained in:
The MMGen Project 2026-05-21 12:09:33 +00:00
commit b29b8b4b9c
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 11 additions and 3 deletions

View file

@ -122,6 +122,8 @@ opts_data = {
-x, --debug-pexpect Produce debugging output for pexpect calls
--, --demo Add extra delay after each send to make input visible.
Implies --exact-output --pexpect-spawn --buf-keypress
--, --dev-mode Run spawned scripts in Python Development Mode
(PYTHONDEVMODE=1 PYTHONTRACEMALLOC=10)
-d, --deps-only Run a command or command subgroups dependencies without
running the command or command group itself.
-D, --no-daemon-stop Don't stop auto-started daemons after running tests

View file

@ -67,7 +67,8 @@ class CmdTestPexpect:
timeout = int(
timeout
or cfg.pexpect_timeout
or cfg.test_suite_pexpect_timeout) or (60, 5)[bool(cfg.debug_pexpect)]
or cfg.test_suite_pexpect_timeout) or (
5 if cfg.debug_pexpect else 180 if cfg.dev_mode else 60)
if pexpect_spawn:
self.p = pexpect.spawn(args[0], args[1:], encoding='utf8', timeout=timeout, env=spawn_env)
else:

View file

@ -105,14 +105,19 @@ class CmdTestRunner:
def set_spawn_env(self):
self.spawn_env = dict(os.environ)
self.spawn_env.update({
'MMGEN_NO_LICENSE': '1',
'MMGEN_BOGUS_SEND': '1',
'MMGEN_TEST_SUITE_PEXPECT': '1',
'EXEC_WRAPPER_DO_RUNTIME_MSG':'1',
# if cmdtest.py itself is running under exec_wrapper, disable writing of traceback file for spawned script
'EXEC_WRAPPER_TRACEBACK': '' if os.getenv('MMGEN_EXEC_WRAPPER') else '1',
})
'EXEC_WRAPPER_TRACEBACK': '' if os.getenv('MMGEN_EXEC_WRAPPER') else '1'})
if self.cfg.dev_mode:
self.spawn_env.update({
'PYTHONDEVMODE': '1',
'PYTHONTRACEMALLOC': '10'})
if self.cfg.exact_output:
from mmgen.term import get_terminal_size