cfg.py: rename some test-related env vars

This commit is contained in:
The MMGen Project 2026-09-13 15:50:14 +00:00
commit e3138a70f4
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
14 changed files with 30 additions and 30 deletions

View file

@ -207,7 +207,6 @@ class Config(Lockable):
debug_rpc = False
debug_subseed = False
debug_tw = False
devtools = False
traceback = False
# rpc:
@ -262,24 +261,25 @@ class Config(Lockable):
priority = 0
# test suite:
debug_utf8 = False
exec_wrapper = False
ignore_test_py_exception = False
test_suite = False
test_suite_autosign_led_simulate = False
test_suite_autosign_threaded = False
test_suite_bogus_send = False
test_suite_bogus_unspent_data = ''
test_suite_devnet_block_period = 0
test_suite_xmr_autosign = False
test_suite_cfgtest = False
test_suite_debug_utf8 = False
test_suite_deterministic = False
test_suite_devnet_block_period = 0
test_suite_devtools = False
test_suite_exec_wrapper = False
test_suite_hold_protect_disable = False
test_suite_ignore_test_py_exception = False
test_suite_legacy_tx = False
test_suite_pexpect = False
test_suite_pexpect_timeout = 0
test_suite_popen_spawn = False
test_suite_root_pfx = ''
hold_protect_disable = False
test_suite_xmr_autosign = False
no_daemon_autostart = False
names = False
no_timings = False
@ -351,7 +351,7 @@ class Config(Lockable):
'MMGEN_DEBUG_ALL', # special: there is no `debug_all` attribute
'MMGEN_AES_BACKEND',
'MMGEN_BLACKLIST_DAEMONS',
'MMGEN_BLACKLISTED_DAEMONS',
'MMGEN_COLUMNS',
'MMGEN_DAEMON_STATE_TIMEOUT',
'MMGEN_DEBUG',
@ -362,16 +362,11 @@ class Config(Lockable):
'MMGEN_DEBUG_RPC',
'MMGEN_DEBUG_SUBSEED',
'MMGEN_DEBUG_TW',
'MMGEN_DEBUG_UTF8',
'MMGEN_DEVTOOLS',
'MMGEN_DISABLE_COLOR',
'MMGEN_ENABLE_ERIGON',
'MMGEN_EXEC_WRAPPER',
'MMGEN_FORCE_256_COLOR',
'MMGEN_HOLD_PROTECT_DISABLE',
'MMGEN_HTTP_TIMEOUT',
'MMGEN_IGNORE_DAEMON_VERSION',
'MMGEN_IGNORE_TEST_PY_EXCEPTION',
'MMGEN_NO_LICENSE',
'MMGEN_QUIET',
'MMGEN_REGTEST',
@ -385,9 +380,14 @@ class Config(Lockable):
'MMGEN_TEST_SUITE_BOGUS_SEND',
'MMGEN_TEST_SUITE_BOGUS_UNSPENT_DATA',
'MMGEN_TEST_SUITE_CFGTEST',
'MMGEN_TEST_SUITE_DEBUG_UTF8',
'MMGEN_TEST_SUITE_DETERMINISTIC',
'MMGEN_TEST_SUITE_DEVTOOLS',
'MMGEN_TEST_SUITE_DEVNET_BLOCK_PERIOD',
'MMGEN_TEST_SUITE_ENABLE_COLOR',
'MMGEN_TEST_SUITE_EXEC_WRAPPER',
'MMGEN_TEST_SUITE_HOLD_PROTECT_DISABLE',
'MMGEN_TEST_SUITE_IGNORE_TEST_PY_EXCEPTION',
'MMGEN_TEST_SUITE_LEGACY_TX',
'MMGEN_TEST_SUITE_PEXPECT',
'MMGEN_TEST_SUITE_PEXPECT_TIMEOUT',

View file

@ -66,7 +66,7 @@ def launch(*, mod=None, func=None, fqmod=None, package='mmgen'):
e = e))
+ '\n')
if os.getenv('MMGEN_EXEC_WRAPPER') or os.getenv('MMGEN_TRACEBACK'):
if os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER') or os.getenv('MMGEN_TRACEBACK'):
raise
sys.exit(d.exit_val)

View file

@ -35,7 +35,7 @@ def exec_wrapper_init():
else:
exec_wrapper_sys.path.pop(0)
exec_wrapper_os.environ['MMGEN_EXEC_WRAPPER'] = '1'
exec_wrapper_os.environ['MMGEN_TEST_SUITE_EXEC_WRAPPER'] = '1'
def exec_wrapper_write_traceback(e, exit_val):
@ -142,7 +142,7 @@ if exec_wrapper_os.getenv('MMGEN_TRACEMALLOC'):
exec_wrapper_tracemalloc_setup()
# import mmgen mods only after sys.path[0] is set to overlay root!
if exec_wrapper_os.getenv('MMGEN_DEVTOOLS'):
if exec_wrapper_os.getenv('MMGEN_TEST_SUITE_DEVTOOLS'):
from mmgen.devinit import init_dev as exec_wrapper_init_dev
exec_wrapper_init_dev()

View file

@ -309,7 +309,7 @@ if __name__ == '__main__':
die(1, yellow('\ntest.py exiting at user request'))
except TestSuiteSpawnedScriptException as e:
# if spawned script is not running under exec_wrapper, output brief error msg:
if os.getenv('MMGEN_EXEC_WRAPPER'):
if os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER'):
Msg(red(str(e)))
Msg(blue('cmdtest.py: spawned script exited with error'))
if hasattr(tr, 'tg'):
@ -323,6 +323,6 @@ if __name__ == '__main__':
del tr.tg
del tr
# if cmdtest.py itself is running under exec_wrapper, re-raise so wrapper can handle exception:
if os.getenv('MMGEN_EXEC_WRAPPER') or not os.getenv('MMGEN_IGNORE_TEST_PY_EXCEPTION'):
if os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER') or not os.getenv('MMGEN_TEST_SUITE_IGNORE_TEST_PY_EXCEPTION'):
raise
die(1, red('Test script exited with error'))

View file

@ -243,7 +243,7 @@ class CmdTestAutosignBase(CmdTestBase):
for coindir, fn in (fn_data + extra_fn_data):
src = joinpath(ref_dir, coindir, fn)
if self.cfg.debug_utf8:
if self.cfg.test_suite_debug_utf8:
ext = '.testnet.rawtx' if fn.endswith('.testnet.rawtx') else '.rawtx'
fn = fn[:-len(ext)] + '-α' + ext
target = joinpath(getattr(self.asi, tx_dir), fn)

View file

@ -80,7 +80,7 @@ class CmdTestBase:
@property
def utf8_suf(self):
return '-α' if self.cfg.debug_utf8 else ''
return '-α' if self.cfg.test_suite_debug_utf8 else ''
@property
def tmpdir(self):

View file

@ -286,7 +286,7 @@ def fixup_cfgs():
for k, v in cfgs.items():
v['segwit'] = randbool() if cfg.segwit_random else bool(cfg.segwit or cfg.bech32)
if cfg.debug_utf8:
if cfg.test_suite_debug_utf8:
for k, v in cfgs.items():
v['tmpdir'] += '-α'

View file

@ -102,7 +102,7 @@ def randbool():
def cleanup_env(cfg):
ret = dict(os.environ)
if cfg.debug_utf8:
if cfg.test_suite_debug_utf8:
return ret
for k in cfg._env_opts:
if k[:11] == 'MMGEN_DEBUG' and k in ret:

View file

@ -64,7 +64,7 @@ class CmdTestRunner:
self.skipped_warnings = []
self.resume_cmd = None
self.deps_only = None
self.logging = self.cfg.log or os.getenv('MMGEN_EXEC_WRAPPER')
self.logging = self.cfg.log or os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER')
self.testing_segwit = cfg.segwit or cfg.segwit_random or cfg.bech32
self.network_id = self.proto.coin.lower() + ('_tn' if self.proto.testnet else '')
self.daemon_started = False
@ -114,7 +114,7 @@ class CmdTestRunner:
'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_TEST_SUITE_EXEC_WRAPPER') else '1'})
if self.cfg.dev_mode:
self.spawn_env.update({
@ -215,7 +215,7 @@ class CmdTestRunner:
spawn_env = dict(self.tg.spawn_env)
spawn_env.update({
'MMGEN_HOLD_PROTECT_DISABLE': '' if send_delay else '1',
'MMGEN_TEST_SUITE_HOLD_PROTECT_DISABLE': '' if send_delay else '1',
'MMGEN_TEST_SUITE_POPEN_SPAWN': '' if pexpect_spawn else '1',
'EXEC_WRAPPER_EXIT_VAL': '' if exit_val is None else str(exit_val),
})

View file

@ -26,6 +26,6 @@ os.environ['PYTHONPATH'] = overlay_root
if 'TMUX' in os.environ:
del os.environ['TMUX']
if os.getenv('MMGEN_DEVTOOLS'):
if os.getenv('MMGEN_TEST_SUITE_DEVTOOLS'):
from mmgen.devinit import init_dev
init_dev()

View file

@ -26,7 +26,7 @@ os.environ['MMGEN_TEST_SUITE_LEGACY_TX'] = '1'
from .test_init import repo_root
if not os.getenv('MMGEN_DEVTOOLS'):
if not os.getenv('MMGEN_TEST_SUITE_DEVTOOLS'):
from mmgen.devinit import init_dev
init_dev()

View file

@ -31,7 +31,7 @@ match cfg._args:
from ast import literal_eval
func_args = literal_eval(args)
msg(f'\n term: {get_char.__self__.__name__}')
msg(f' cfg.hold_protect_disable: {cfg.hold_protect_disable}')
msg(f' cfg.test_suite_hold_protect_disable: {cfg.test_suite_hold_protect_disable}')
if cmd == 'line_input':
func_args.update({'cfg':cfg})
msg(' Calling {name}({args})'.format(

View file

@ -25,7 +25,7 @@ async def do_txfile_test(desc, fns, cfg=cfg, do_format=True):
f = MMGenTxFile(tx)
fn_gen = f.make_filename()
if cfg.debug_utf8:
if cfg.test_suite_debug_utf8:
fn_gen = fn_gen.replace('-α', '')
assert fn_gen == os.path.basename(fn), f'{fn_gen} != {fn}'

View file

@ -30,7 +30,7 @@ except ImportError:
# for objtest, violate MMGen Project best practices and allow use of the dev tools
# in production code:
from mmgen.devtools import pmsg
if not os.getenv('MMGEN_DEVTOOLS'):
if not os.getenv('MMGEN_TEST_SUITE_DEVTOOLS'):
from mmgen.devinit import init_dev
init_dev()