test suite: relocate a module, delete a module
This commit is contained in:
parent
b7446566a2
commit
6e5e32f148
5 changed files with 16 additions and 25 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -17,19 +17,21 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
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,
|
||||
|
|
@ -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':
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# MMGen Wallet, a terminal-based cryptocurrency wallet
|
||||
# Copyright (C)2013-2025 The MMGen Project <mmgen@tuta.io>
|
||||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue