From e3138a70f454c034cf697667ad975bdd19c866d8 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 13 Sep 2026 15:50:14 +0000 Subject: [PATCH] cfg.py: rename some test-related env vars --- mmgen/cfg.py | 26 +++++++++++++------------- mmgen/main.py | 2 +- scripts/exec_wrapper.py | 4 ++-- test/cmdtest.py | 4 ++-- test/cmdtest_d/autosign.py | 2 +- test/cmdtest_d/base.py | 2 +- test/cmdtest_d/include/cfg.py | 2 +- test/cmdtest_d/include/common.py | 2 +- test/cmdtest_d/include/runner.py | 6 +++--- test/include/test_init.py | 2 +- test/include/unit_test.py | 2 +- test/misc/input_func.py | 2 +- test/modtest_d/tx.py | 2 +- test/objtest.py | 2 +- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/mmgen/cfg.py b/mmgen/cfg.py index 701e9900..56fb3c54 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -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', diff --git a/mmgen/main.py b/mmgen/main.py index a1a57e14..5ee8c2b9 100755 --- a/mmgen/main.py +++ b/mmgen/main.py @@ -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) diff --git a/scripts/exec_wrapper.py b/scripts/exec_wrapper.py index 7b2fad11..ec9d8e49 100755 --- a/scripts/exec_wrapper.py +++ b/scripts/exec_wrapper.py @@ -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() diff --git a/test/cmdtest.py b/test/cmdtest.py index 9b728923..6424828a 100755 --- a/test/cmdtest.py +++ b/test/cmdtest.py @@ -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')) diff --git a/test/cmdtest_d/autosign.py b/test/cmdtest_d/autosign.py index dca0a0be..8ea82205 100755 --- a/test/cmdtest_d/autosign.py +++ b/test/cmdtest_d/autosign.py @@ -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) diff --git a/test/cmdtest_d/base.py b/test/cmdtest_d/base.py index 3612a42b..c4b9808b 100755 --- a/test/cmdtest_d/base.py +++ b/test/cmdtest_d/base.py @@ -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): diff --git a/test/cmdtest_d/include/cfg.py b/test/cmdtest_d/include/cfg.py index 7af6c2a6..fea4c33c 100755 --- a/test/cmdtest_d/include/cfg.py +++ b/test/cmdtest_d/include/cfg.py @@ -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'] += '-α' diff --git a/test/cmdtest_d/include/common.py b/test/cmdtest_d/include/common.py index 9030b15c..67e30a0b 100755 --- a/test/cmdtest_d/include/common.py +++ b/test/cmdtest_d/include/common.py @@ -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: diff --git a/test/cmdtest_d/include/runner.py b/test/cmdtest_d/include/runner.py index f9620030..66dd4a00 100755 --- a/test/cmdtest_d/include/runner.py +++ b/test/cmdtest_d/include/runner.py @@ -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), }) diff --git a/test/include/test_init.py b/test/include/test_init.py index d4191901..b841b360 100755 --- a/test/include/test_init.py +++ b/test/include/test_init.py @@ -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() diff --git a/test/include/unit_test.py b/test/include/unit_test.py index 9b372524..2ebee806 100755 --- a/test/include/unit_test.py +++ b/test/include/unit_test.py @@ -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() diff --git a/test/misc/input_func.py b/test/misc/input_func.py index ad3dfc61..8274ed08 100755 --- a/test/misc/input_func.py +++ b/test/misc/input_func.py @@ -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( diff --git a/test/modtest_d/tx.py b/test/modtest_d/tx.py index a5398907..e07f113b 100755 --- a/test/modtest_d/tx.py +++ b/test/modtest_d/tx.py @@ -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}' diff --git a/test/objtest.py b/test/objtest.py index eec629b7..9fd4eeca 100755 --- a/test/objtest.py +++ b/test/objtest.py @@ -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()