cmdtest.py: new --dev-mode option
This commit is contained in:
parent
77a42a1df9
commit
b29b8b4b9c
3 changed files with 11 additions and 3 deletions
|
|
@ -122,6 +122,8 @@ opts_data = {
|
||||||
-x, --debug-pexpect Produce debugging output for pexpect calls
|
-x, --debug-pexpect Produce debugging output for pexpect calls
|
||||||
--, --demo Add extra delay after each send to make input visible.
|
--, --demo Add extra delay after each send to make input visible.
|
||||||
Implies --exact-output --pexpect-spawn --buf-keypress
|
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 subgroup’s dependencies without
|
-d, --deps-only Run a command or command subgroup’s dependencies without
|
||||||
running the command or command group itself.
|
running the command or command group itself.
|
||||||
-D, --no-daemon-stop Don't stop auto-started daemons after running tests
|
-D, --no-daemon-stop Don't stop auto-started daemons after running tests
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,8 @@ class CmdTestPexpect:
|
||||||
timeout = int(
|
timeout = int(
|
||||||
timeout
|
timeout
|
||||||
or cfg.pexpect_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:
|
if pexpect_spawn:
|
||||||
self.p = pexpect.spawn(args[0], args[1:], encoding='utf8', timeout=timeout, env=spawn_env)
|
self.p = pexpect.spawn(args[0], args[1:], encoding='utf8', timeout=timeout, env=spawn_env)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -105,14 +105,19 @@ class CmdTestRunner:
|
||||||
def set_spawn_env(self):
|
def set_spawn_env(self):
|
||||||
|
|
||||||
self.spawn_env = dict(os.environ)
|
self.spawn_env = dict(os.environ)
|
||||||
|
|
||||||
self.spawn_env.update({
|
self.spawn_env.update({
|
||||||
'MMGEN_NO_LICENSE': '1',
|
'MMGEN_NO_LICENSE': '1',
|
||||||
'MMGEN_BOGUS_SEND': '1',
|
'MMGEN_BOGUS_SEND': '1',
|
||||||
'MMGEN_TEST_SUITE_PEXPECT': '1',
|
'MMGEN_TEST_SUITE_PEXPECT': '1',
|
||||||
'EXEC_WRAPPER_DO_RUNTIME_MSG':'1',
|
'EXEC_WRAPPER_DO_RUNTIME_MSG':'1',
|
||||||
# if cmdtest.py itself is running under exec_wrapper, disable writing of traceback file for spawned script
|
# 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:
|
if self.cfg.exact_output:
|
||||||
from mmgen.term import get_terminal_size
|
from mmgen.term import get_terminal_size
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue