diff --git a/mmgen/util.py b/mmgen/util.py
index ae41a0be..0c9f7100 100755
--- a/mmgen/util.py
+++ b/mmgen/util.py
@@ -366,6 +366,11 @@ def check_int_between(val, imin, imax, *, desc):
die(1, f'{val}: invalid value for {desc} (must be between {imin} and {imax})')
return int(val)
+def check_member(e, iterable, desc, message='unsupported'):
+ if e not in iterable:
+ from mmgen.color import yellow
+ die(1, yellow(f'{e}: {message} {desc} (must be one of {fmt_list(iterable)})'))
+
def is_hex_str(s):
return set(s) <= set(hexdigits)
diff --git a/test/clean.py b/test/clean.py
index 5522abe0..945576c9 100755
--- a/test/clean.py
+++ b/test/clean.py
@@ -44,12 +44,11 @@ from test.include.common import clean, set_globals
set_globals(cfg)
-from test.include.cfg import clean_cfgs
-
extra_dirs = [
Config.test_datadir,
os.path.join('test', 'trash'),
os.path.join('test', 'trash2')
]
-clean(clean_cfgs, extra_dirs=extra_dirs)
+from test.cmdtest_d.include.cfg import cfgs
+clean(cfgs, extra_dirs=extra_dirs)
diff --git a/test/include/pexpect.py b/test/cmdtest_d/include/pexpect.py
similarity index 96%
rename from test/include/pexpect.py
rename to test/cmdtest_d/include/pexpect.py
index 1d49d765..feeedb99 100755
--- a/test/include/pexpect.py
+++ b/test/cmdtest_d/include/pexpect.py
@@ -17,19 +17,21 @@
# along with this program. If not, see .
"""
-test.include.pexpect: pexpect implementation for MMGen test suites
+test.cmdtest_d.include.pexpect: pexpect implementation for MMGen Wallet cmdtest suite
"""
import sys, time
+
from mmgen.color import red, yellow, green, cyan
from mmgen.util import msg, msg_r, rmsg, die
-from .common import cfg, vmsg, vmsg_r, getrandstr, strip_ansi_escapes
+
+from ...include.common import cfg, vmsg, vmsg_r, getrandstr, strip_ansi_escapes
try:
import pexpect
from pexpect.popen_spawn import PopenSpawn
except ImportError as e:
- die(2, red(f'Pexpect module is missing. Cannnot run test suite ({e!r})'))
+ die(2, red(f'‘pexpect’ module is missing. Cannnot run test suite ({e!r})'))
def debug_pexpect_msg(p):
msg('\n{}{}{}'.format(red('BEFORE ['), p.before, red(']')))
@@ -37,7 +39,7 @@ def debug_pexpect_msg(p):
NL = '\n'
-class MMGenPexpect:
+class CmdTestPexpect:
def __init__(
self,
diff --git a/test/cmdtest_d/include/runner.py b/test/cmdtest_d/include/runner.py
index 79b2deb5..672e2e23 100755
--- a/test/cmdtest_d/include/runner.py
+++ b/test/cmdtest_d/include/runner.py
@@ -212,8 +212,8 @@ class CmdTestRunner:
})
spawn_env.update(env)
- from test.include.pexpect import MMGenPexpect
- return MMGenPexpect(
+ from .pexpect import CmdTestPexpect
+ return CmdTestPexpect(
args = args,
no_output = no_output,
spawn_env = spawn_env,
@@ -491,7 +491,7 @@ class CmdTestRunner:
print(r+('\n'+r).join(self.skipped_warnings))
def process_retval(self, cmd, ret):
- if type(ret).__name__ == 'MMGenPexpect':
+ if type(ret).__name__ == 'CmdTestPexpect':
ret.ok(exit_val=self.exit_val)
self.cmd_total += 1
elif ret == 'ok':
diff --git a/test/include/cfg.py b/test/include/cfg.py
deleted file mode 100755
index 114c874b..00000000
--- a/test/include/cfg.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env python3
-#
-# MMGen Wallet, a terminal-based cryptocurrency wallet
-# Copyright (C)2013-2025 The MMGen Project
-# Licensed under the GNU General Public License, Version 3:
-# https://www.gnu.org/licenses
-# Public project repositories:
-# https://github.com/mmgen/mmgen-wallet
-# https://gitlab.com/mmgen/mmgen-wallet
-
-"""
-test.include.cfg: Configuration for test scripts
-"""
-
-from ..cmdtest_d.include.cfg import cfgs as clean_cfgs