From e99950373a1e3dd56fcfc25352a9d71d0df22388 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 3 Oct 2023 14:27:57 +0000 Subject: [PATCH] delete mmgen/common.py; import fixes and cleanups throughout (deglob) --- mmgen/common.py | 26 ---------------------- mmgen/main_addrgen.py | 2 ++ mmgen/main_txsign.py | 2 +- mmgen/mn_entry.py | 1 - mmgen/obj.py | 2 +- mmgen/seedsplit.py | 6 +++-- mmgen/subseed.py | 7 +++--- mmgen/util.py | 2 +- test/colortest.py | 4 +++- test/gentest.py | 3 ++- test/include/pexpect.py | 3 ++- test/test_py_d/cfg.py | 4 +++- test/test_py_d/ts_autosign.py | 21 +++++++++++++----- test/test_py_d/ts_base.py | 7 ++++-- test/test_py_d/ts_cfgfile.py | 9 ++++---- test/test_py_d/ts_chainsplit.py | 13 +++++------ test/test_py_d/ts_ethdev.py | 37 ++++++++++++++++++++++++++----- test/test_py_d/ts_input.py | 21 +++++++++++++----- test/test_py_d/ts_main.py | 36 +++++++++++++++++++++++++----- test/test_py_d/ts_misc.py | 8 ++++--- test/test_py_d/ts_opts.py | 6 +++-- test/test_py_d/ts_ref.py | 29 ++++++++++++++++++++---- test/test_py_d/ts_ref_3seed.py | 20 ++++++++++++----- test/test_py_d/ts_ref_altcoin.py | 8 +++---- test/test_py_d/ts_regtest.py | 34 +++++++++++++++++++++++----- test/test_py_d/ts_seedsplit.py | 6 ++++- test/test_py_d/ts_shared.py | 5 +++-- test/test_py_d/ts_tool.py | 16 +++++++++++-- test/test_py_d/ts_wallet.py | 11 +++++---- test/test_py_d/ts_xmr_autosign.py | 18 ++++++++++++++- test/test_py_d/ts_xmrwallet.py | 22 ++++++++++++++---- test/tooltest2.py | 3 +-- test/unit_tests_d/ut_dep.py | 2 +- test/unit_tests_d/ut_xmrseed.py | 2 +- 34 files changed, 279 insertions(+), 117 deletions(-) delete mode 100755 mmgen/common.py diff --git a/mmgen/common.py b/mmgen/common.py deleted file mode 100755 index 136c13b6..00000000 --- a/mmgen/common.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 -# -# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution -# Copyright (C)2013-2023 The MMGen Project -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -""" -common: Common imports for all MMGen scripts -""" - -import sys,os -from .cfg import * -import mmgen.opts as opts -from .util import * diff --git a/mmgen/main_addrgen.py b/mmgen/main_addrgen.py index 1a4037a9..c5b39aa3 100755 --- a/mmgen/main_addrgen.py +++ b/mmgen/main_addrgen.py @@ -22,6 +22,7 @@ mmgen-addrgen: Generate a series or range of addresses from an MMGen """ import mmgen.opts as opts + from .cfg import gc,Config from .addr import MMGenAddrType from .addrfile import AddrFile @@ -172,6 +173,7 @@ af = al.file af.format() if al.gen_addrs and cfg.print_checksum: + from .util import Die Die(0,al.checksum) from .ui import keypress_confirm diff --git a/mmgen/main_txsign.py b/mmgen/main_txsign.py index bd0d3a74..9011e385 100755 --- a/mmgen/main_txsign.py +++ b/mmgen/main_txsign.py @@ -114,7 +114,7 @@ if not cfg.info and not cfg.terse_info: from .ui import do_license_msg do_license_msg(cfg,immed=True) -from .tx.sign import * +from .tx.sign import txsign,get_tx_files,get_seed_files,get_keylist,get_keyaddrlist tx_files = get_tx_files(cfg,infiles) seed_files = get_seed_files(cfg,infiles) diff --git a/mmgen/mn_entry.py b/mmgen/mn_entry.py index 6437f257..3995d7d2 100755 --- a/mmgen/mn_entry.py +++ b/mmgen/mn_entry.py @@ -22,7 +22,6 @@ mn_entry.py - Mnemonic user entry methods for the MMGen suite import time -from .cfg import * from .util import msg,msg_r,fmt,fmt_list,capfirst,die,ascii_lowercase from .term import get_char,get_char_raw from .color import cyan diff --git a/mmgen/obj.py b/mmgen/obj.py index ba86fd2c..658364f5 100755 --- a/mmgen/obj.py +++ b/mmgen/obj.py @@ -22,7 +22,7 @@ obj: MMGen native classes import sys,os,re,unicodedata -from .objmethods import * +from .objmethods import MMGenObject,Hilite,InitErrors def get_obj(objname,*args,**kwargs): """ diff --git a/mmgen/seedsplit.py b/mmgen/seedsplit.py index 4f285f5f..b3eef381 100755 --- a/mmgen/seedsplit.py +++ b/mmgen/seedsplit.py @@ -22,8 +22,10 @@ seedsplit: Seed split classes and methods for the MMGen suite from .color import yellow from .util import msg,die -from .obj import MMGenPWIDString,MMGenIdx,get_obj -from .subseed import * +from .objmethods import MMGenObject,Hilite,InitErrors +from .obj import ImmutableAttr,MMGenPWIDString,MMGenIdx,get_obj,IndexedDict +from .seed import Seed,SeedBase +from .subseed import SubSeedList,SubSeedIdx,SubSeed from .crypto import Crypto class SeedShareIdx(MMGenIdx): diff --git a/mmgen/subseed.py b/mmgen/subseed.py index 4ec02164..71e5d3e7 100755 --- a/mmgen/subseed.py +++ b/mmgen/subseed.py @@ -21,9 +21,10 @@ subseed: Subseed classes and methods for the MMGen suite """ from .color import green -from .util import msg_r,msg,die -from .obj import MMGenRange,IndexedDict -from .seed import * +from .util import msg_r,msg,die,make_chksum_8 +from .objmethods import MMGenObject,Hilite,InitErrors +from .obj import MMGenRange,IndexedDict,ImmutableAttr +from .seed import SeedBase,SeedID class SubSeedIdxRange(MMGenRange): min_idx = 1 diff --git a/mmgen/util.py b/mmgen/util.py index ead187d0..d7e10cb6 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -22,7 +22,7 @@ util: Frequently-used variables, classes and utility functions for the MMGen sui import sys,os,time,re -from .color import * +from .color import red,yellow,green,blue,purple from .cfg import gv,gc ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz' diff --git a/test/colortest.py b/test/colortest.py index 5f250b6a..5585b482 100755 --- a/test/colortest.py +++ b/test/colortest.py @@ -7,8 +7,10 @@ test/colortest.py: test color handling for the MMGen suite """ +import os + import include.test_init -from include.common import * + from mmgen.color import * from mmgen.util import msg,ymsg,gmsg import mmgen.color as color_mod diff --git a/test/gentest.py b/test/gentest.py index 65b50d12..aabef214 100755 --- a/test/gentest.py +++ b/test/gentest.py @@ -541,7 +541,8 @@ def main(): from subprocess import run,PIPE,DEVNULL from collections import namedtuple from mmgen.protocol import init_proto,CoinProtocol -from mmgen.altcoin import init_genonly_altcoins,CoinInfo as cinfo +from mmgen.altcoin import init_genonly_altcoins +from mmgen.altcoin import CoinInfo as cinfo from mmgen.key import PrivKey from mmgen.addr import MMGenAddrType from mmgen.addrgen import KeyGenerator,AddrGenerator diff --git a/test/include/pexpect.py b/test/include/pexpect.py index 14cba199..daa06c69 100755 --- a/test/include/pexpect.py +++ b/test/include/pexpect.py @@ -21,7 +21,8 @@ test.include.pexpect: pexpect implementation for MMGen test suites """ import sys,os,time -from mmgen.util import msg,msg_r,rmsg,red,yellow,green,cyan,die +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 try: diff --git a/test/test_py_d/cfg.py b/test/test_py_d/cfg.py index 9850bd09..7b3fe085 100755 --- a/test/test_py_d/cfg.py +++ b/test/test_py_d/cfg.py @@ -12,7 +12,9 @@ test.test_py_d.cfg: configuration data for test.py """ -from .common import * +import os + +from .common import pwfile,hincog_fn,incog_id_fn,randbool from ..include.common import cfg cmd_groups_dfl = { diff --git a/test/test_py_d/ts_autosign.py b/test/test_py_d/ts_autosign.py index 05434af2..daa8ed46 100755 --- a/test/test_py_d/ts_autosign.py +++ b/test/test_py_d/ts_autosign.py @@ -26,13 +26,22 @@ from pathlib import Path from mmgen.cfg import gc from mmgen.color import red,green,blue,purple -from mmgen.util import suf +from mmgen.util import msg,suf,die -from ..include.common import * -from .common import * -from .ts_base import * -from .ts_shared import * -from .input import * +from ..include.common import ( + cfg, + omsg, + omsg_r, + start_test_daemons, + stop_test_daemons, + joinpath, + imsg, + read_from_file +) +from .common import ref_dir,dfl_words_file,dfl_bip39_file + +from .ts_base import TestSuiteBase +from .input import stealth_mnemonic_entry from mmgen.led import LEDControl from mmgen.autosign import Autosign,AutosignConfig diff --git a/test/test_py_d/ts_base.py b/test/test_py_d/ts_base.py index a5588145..a8479c56 100755 --- a/test/test_py_d/ts_base.py +++ b/test/test_py_d/ts_base.py @@ -21,9 +21,12 @@ test.test_py_d.ts_base: Base class for the test.py test suite """ import os + from mmgen.cfg import gc -from ..include.common import * -from .common import * +from mmgen.util import msg + +from ..include.common import cfg,write_to_file,read_from_file +from .common import get_file_with_ext class TestSuiteBase: 'initializer class for the test.py test suite' diff --git a/test/test_py_d/ts_cfgfile.py b/test/test_py_d/ts_cfgfile.py index 75cac871..ff73b45d 100755 --- a/test/test_py_d/ts_cfgfile.py +++ b/test/test_py_d/ts_cfgfile.py @@ -10,13 +10,14 @@ test.test_py_d.ts_cfgfile: CfgFile tests for the MMGen test.py test suite """ -import time,shutil +import os,time,shutil -from ..include.common import * -from .ts_base import * +from ..include.common import cfg,read_from_file,write_to_file,imsg +from .ts_base import TestSuiteBase -from mmgen.cfgfile import * +from mmgen.cfg import gc from mmgen.color import yellow +from mmgen.cfgfile import CfgFileSampleSys,CfgFileSampleUsr,cfg_file_sample class TestSuiteCfgFile(TestSuiteBase): 'CfgFile API' diff --git a/test/test_py_d/ts_chainsplit.py b/test/test_py_d/ts_chainsplit.py index 1edb4408..91a8f355 100755 --- a/test/test_py_d/ts_chainsplit.py +++ b/test/test_py_d/ts_chainsplit.py @@ -20,14 +20,13 @@ test.test_py_d.ts_chainsplit: Forking scenario tests for the test.py test suite This module is unmaintained and currently non-functional """ -import os -from mmgen.util import die -from ..include.common import * -from .common import * -from .ts_base import * -from .ts_shared import * -from .ts_regtest import * +import os + +from mmgen.util import die + +from .common import get_file_with_ext +from .ts_regtest import TestSuiteRegtest class TestSuiteChainsplit(TestSuiteRegtest): 'forking scenario tests for the test.py test suite' diff --git a/test/test_py_d/ts_ethdev.py b/test/test_py_d/ts_ethdev.py index 1522ad0f..48622ed7 100755 --- a/test/test_py_d/ts_ethdev.py +++ b/test/test_py_d/ts_ethdev.py @@ -27,10 +27,38 @@ from subprocess import run,PIPE,DEVNULL from mmgen.cfg import gc from mmgen.color import yellow,blue,cyan,set_vt100 -from mmgen.util import die +from mmgen.util import msg,rmsg,die from mmgen.protocol import CoinProtocol -from ..include.common import * -from .common import * + +from ..include.common import ( + cfg, + check_solc_ver, + omsg, + imsg, + imsg_r, + joinpath, + read_from_file, + write_to_file, + cmp_or_die, + strip_ansi_escapes, + silence, + end_silence, + gr_uc, + stop_test_daemons +) +from .common import ( + ref_dir, + dfl_words_file, + tx_comment_jp, + tx_comment_lat_cyr_gr, + tw_comment_zh, + tw_comment_lat_cyr_gr, + get_file_with_ext, + ok_msg, + Ctrl_U +) +from .ts_base import TestSuiteBase +from .ts_shared import TestSuiteShared del_addrs = ('4','1') dfl_sid = '98831F3A' @@ -116,9 +144,6 @@ token_bals_getbalance = { '2': ('111.888877776666555545','888.111122223333444455') } -from .ts_base import * -from .ts_shared import * - coin = cfg.coin class TestSuiteEthdev(TestSuiteBase,TestSuiteShared): diff --git a/test/test_py_d/ts_input.py b/test/test_py_d/ts_input.py index f2fa1eb0..9bae3c27 100755 --- a/test/test_py_d/ts_input.py +++ b/test/test_py_d/ts_input.py @@ -10,13 +10,24 @@ test.test_py_d.ts_input: user input tests for the MMGen test.py test suite """ -import time +import os,time -from ..include.common import * -from .ts_base import * -from .input import * +from ..include.common import ( + cfg, + imsg, + imsg_r, + sample_mn, + get_data_from_file, + read_from_file, + strip_ansi_escapes +) +from .common import Ctrl_U,ref_dir +from .ts_base import TestSuiteBase +from .input import stealth_mnemonic_entry,user_dieroll_entry -from mmgen.util import capfirst,remove_whitespace +from mmgen.cfg import gc +from mmgen.color import set_vt100 +from mmgen.util import fmt,capfirst,remove_whitespace from mmgen.wallet import get_wallet_cls class TestSuiteInput(TestSuiteBase): diff --git a/test/test_py_d/ts_main.py b/test/test_py_d/ts_main.py index 8e34846a..5e68ca6a 100755 --- a/test/test_py_d/ts_main.py +++ b/test/test_py_d/ts_main.py @@ -20,18 +20,42 @@ test.test_py_d.ts_main: Basic operations tests for the test.py test suite """ -from mmgen.util import async_run,capfirst,get_extension -from mmgen.color import green,cyan +import sys,os +from mmgen.util import msg,msg_r,async_run,capfirst,get_extension,die +from mmgen.color import green,cyan from mmgen.fileutil import get_data_from_file,write_data_to_file from mmgen.wallet import get_wallet_cls from mmgen.wallet.mmgen import wallet as MMGenWallet from mmgen.wallet.incog import wallet as IncogWallet from mmgen.rpc import rpc_init -from ..include.common import * -from .common import * -from .ts_base import * -from .ts_shared import * + +from ..include.common import ( + cfg, + vmsg, + joinpath, + silence, + end_silence, + getrand, + getrandnum, + getrandnum_range, + getrandhex, + strip_ansi_escapes +) +from .common import ( + pwfile, + hincog_fn, + get_file_with_ext, + get_comment, + tx_comment_lat_cyr_gr, + hincog_offset, + hincog_bytes, + hincog_seedlen, + incog_id_fn, + non_mmgen_fn +) +from .ts_base import TestSuiteBase +from .ts_shared import TestSuiteShared def make_brainwallet_file(fn): # Print random words with random whitespace in between diff --git a/test/test_py_d/ts_misc.py b/test/test_py_d/ts_misc.py index a22328e0..de760055 100755 --- a/test/test_py_d/ts_misc.py +++ b/test/test_py_d/ts_misc.py @@ -23,9 +23,11 @@ test.test_py_d.ts_misc: Miscellaneous test groups for the test.py test suite import re,time from mmgen.cfg import gc -from ..include.common import * -from .common import * -from .ts_base import * +from mmgen.util import ymsg + +from ..include.common import cfg,start_test_daemons,stop_test_daemons,imsg +from .common import get_file_with_ext +from .ts_base import TestSuiteBase from .ts_main import TestSuiteMain class TestSuiteMisc(TestSuiteBase): diff --git a/test/test_py_d/ts_opts.py b/test/test_py_d/ts_opts.py index 7e1497b2..ce711910 100755 --- a/test/test_py_d/ts_opts.py +++ b/test/test_py_d/ts_opts.py @@ -10,8 +10,10 @@ test.test_py_d.ts_opts: options processing tests for the MMGen test.py test suite """ -from ..include.common import * -from .ts_base import * +import os + +from ..include.common import cfg +from .ts_base import TestSuiteBase class TestSuiteOpts(TestSuiteBase): 'options processing' diff --git a/test/test_py_d/ts_ref.py b/test/test_py_d/ts_ref.py index 926deb30..09c94872 100755 --- a/test/test_py_d/ts_ref.py +++ b/test/test_py_d/ts_ref.py @@ -21,13 +21,34 @@ test.test_py_d.ts_ref: Reference file tests for the test.py test suite """ import os + from mmgen.util import capfirst from mmgen.wallet import get_wallet_cls -from ..include.common import * -from .common import * +from ..include.common import ( + cfg, + imsg_r, + ok, + joinpath, + cmp_or_die, + ref_kafile_hash_preset, + ref_kafile_pass, + read_from_file, + sample_text +) +from .common import ( + dfl_words_file, + ref_dir, + chksum_pat, + pwfile, + ref_bw_file_spc, + ref_enc_fn, + get_env_without_debug_vars, + tool_enc_passwd, + skip +) -from .ts_base import * -from .ts_shared import * +from .ts_base import TestSuiteBase +from .ts_shared import TestSuiteShared wpasswd = 'reference password' diff --git a/test/test_py_d/ts_ref_3seed.py b/test/test_py_d/ts_ref_3seed.py index 821e0a1d..95330033 100755 --- a/test/test_py_d/ts_ref_3seed.py +++ b/test/test_py_d/ts_ref_3seed.py @@ -21,12 +21,22 @@ test.test_py_d.ts_ref_3seed: Saved and generated reference file tests for 128, 192 and 256-bit seeds for the test.py test suite """ -from mmgen.util import capfirst +import os + +from mmgen.util import msg,capfirst from mmgen.wallet import get_wallet_cls -from ..include.common import * -from .common import * -from .ts_base import * -from .ts_shared import * + +from ..include.common import cfg,cmp_or_die,joinpath +from .common import ( + pwfile, + ref_wallet_hash_preset, + ref_wallet_brainpass, + ref_wallet_incog_offset, + ref_dir, + ok_msg +) +from .ts_base import TestSuiteBase +from .ts_shared import TestSuiteShared from .ts_wallet import TestSuiteWalletConv class TestSuiteRef3Seed(TestSuiteBase,TestSuiteShared): diff --git a/test/test_py_d/ts_ref_altcoin.py b/test/test_py_d/ts_ref_altcoin.py index 0e763ee2..f3ef7d10 100755 --- a/test/test_py_d/ts_ref_altcoin.py +++ b/test/test_py_d/ts_ref_altcoin.py @@ -24,10 +24,10 @@ import os from mmgen.color import set_vt100 -from .common import * -from ..include.common import cfg -from .ts_ref import * -from .ts_base import * +from .common import pwfile,dfl_wpasswd,ref_dir,dfl_words_file,dfl_addr_idx_list +from ..include.common import cfg,joinpath,start_test_daemons,stop_test_daemons,cmp_or_die +from .ts_ref import TestSuiteRef +from .ts_base import TestSuiteBase class TestSuiteRefAltcoin(TestSuiteRef,TestSuiteBase): 'saved and generated altcoin reference files' diff --git a/test/test_py_d/ts_regtest.py b/test/test_py_d/ts_regtest.py index b7e07702..f16c1ea0 100755 --- a/test/test_py_d/ts_regtest.py +++ b/test/test_py_d/ts_regtest.py @@ -22,12 +22,37 @@ test.test_py_d.ts_regtest: Regtest tests for the test.py test suite import os,json,time,re from decimal import Decimal -from mmgen.util import die,gmsg,capfirst,fmt_list,async_run + +from mmgen.color import yellow +from mmgen.util import msg_r,die,gmsg,capfirst,fmt_list,async_run from mmgen.protocol import init_proto from mmgen.addrlist import AddrList from mmgen.wallet import Wallet,get_wallet_cls -from ..include.common import * -from .common import * + +from ..include.common import ( + cfg, + imsg, + omsg, + stop_test_daemons, + joinpath, + silence, + end_silence, + cmp_or_die, + strip_ansi_escapes, + gr_uc, + getrandhex +) +from .common import ( + ok_msg, + get_file_with_ext, + get_comment, + tw_comment_lat_cyr_gr, + tw_comment_zh, + tx_comment_jp, + get_env_without_debug_vars +) +from .ts_base import TestSuiteBase +from .ts_shared import TestSuiteShared pat_date = r'\b\d\d-\d\d-\d\d\b' pat_date_time = r'\b\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d\b' @@ -138,9 +163,6 @@ def make_burn_addr(proto): proto = proto, mmtype = 'compressed' ).pubhash2addr('00'*20) -from .ts_base import * -from .ts_shared import * - class TestSuiteRegtest(TestSuiteBase,TestSuiteShared): 'transacting and tracking wallet operations via regtest mode' networks = ('btc','ltc','bch') diff --git a/test/test_py_d/ts_seedsplit.py b/test/test_py_d/ts_seedsplit.py index 2a998a3b..58d80e3c 100755 --- a/test/test_py_d/ts_seedsplit.py +++ b/test/test_py_d/ts_seedsplit.py @@ -20,10 +20,14 @@ test.test_py_d.ts_seedsplit: Seed split/join tests for the test.py test suite """ +import os + from mmgen.wallet import get_wallet_cls from mmgen.util import capfirst -from .ts_base import * +from ..include.common import strip_ansi_escapes,cmp_or_die +from .common import get_file_with_ext +from .ts_base import TestSuiteBase ref_wf = 'test/ref/98831F3A.bip39' ref_sid = '98831F3A' diff --git a/test/test_py_d/ts_shared.py b/test/test_py_d/ts_shared.py index ff3c5d58..9788b163 100755 --- a/test/test_py_d/ts_shared.py +++ b/test/test_py_d/ts_shared.py @@ -21,11 +21,12 @@ test.test_py_d.ts_shared: Shared methods for the test.py test suite """ import os + from mmgen.util import ymsg,get_extension from mmgen.wallet import get_wallet_cls -from ..include.common import * -from .common import * +from ..include.common import cmp_or_die,strip_ansi_escapes,joinpath +from .common import ref_bw_file class TestSuiteShared(object): 'shared methods for the test.py test suite' diff --git a/test/test_py_d/ts_tool.py b/test/test_py_d/ts_tool.py index 4ad9a189..fc36a1be 100755 --- a/test/test_py_d/ts_tool.py +++ b/test/test_py_d/ts_tool.py @@ -10,11 +10,23 @@ test.test_py_d.ts_tool: tool tests for the MMGen test.py test suite """ +import os + +from mmgen.cfg import gc from mmgen.util import suf from mmgen.color import cyan -from ..include.common import * -from .ts_base import * +from ..include.common import ( + cfg, + vmsg, + read_from_file, + write_to_file, + cmp_or_die, + joinpath, + getrand +) +from .common import hincog_fn,incog_id_fn,hincog_offset,tool_enc_passwd,ref_dir +from .ts_base import TestSuiteBase from .ts_main import TestSuiteMain class TestSuiteTool(TestSuiteMain,TestSuiteBase): diff --git a/test/test_py_d/ts_wallet.py b/test/test_py_d/ts_wallet.py index 29f0eef6..ff4eda1a 100755 --- a/test/test_py_d/ts_wallet.py +++ b/test/test_py_d/ts_wallet.py @@ -21,11 +21,14 @@ test.test_py_d.ts_wallet: Wallet conversion tests for the test.py test suite """ import os -from mmgen.util import capfirst + +from mmgen.util import msg,capfirst,get_extension from mmgen.wallet import get_wallet_cls -from .common import * -from .ts_base import * -from .ts_shared import * + +from ..include.common import cfg,joinpath,imsg +from .common import ref_dir,ref_wallet_brainpass,ref_wallet_incog_offset,hincog_fn,hincog_bytes +from .ts_base import TestSuiteBase +from .ts_shared import TestSuiteShared class TestSuiteWalletConv(TestSuiteBase,TestSuiteShared): 'wallet conversion to and from reference data' diff --git a/test/test_py_d/ts_xmr_autosign.py b/test/test_py_d/ts_xmr_autosign.py index 40b9c835..dff8cda4 100755 --- a/test/test_py_d/ts_xmr_autosign.py +++ b/test/test_py_d/ts_xmr_autosign.py @@ -13,8 +13,23 @@ test.test_py_d.ts_xmr_autosign: xmr autosigning tests for the test.py test suite """ -from .ts_xmrwallet import * +import os,time,re,shutil from pathlib import Path + +from mmgen.color import yellow,purple,gray +from mmgen.util import fmt,async_run + +from ..include.common import ( + cfg, + oqmsg, + oqmsg_r, + imsg, + silence, + end_silence +) +from .common import get_file_with_ext + +from .ts_xmrwallet import TestSuiteXMRWallet from .ts_autosign import TestSuiteAutosignBase def make_burn_addr(): @@ -118,6 +133,7 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase): data = self.users['alice'] from mmgen.wallet import Wallet from mmgen.xmrwallet import MoneroWalletOps,xmrwallet_uargs + from mmgen.addrlist import KeyAddrList silence() kal = KeyAddrList( cfg = self.cfg, diff --git a/test/test_py_d/ts_xmrwallet.py b/test/test_py_d/ts_xmrwallet.py index d5c956f0..6ab7e860 100755 --- a/test/test_py_d/ts_xmrwallet.py +++ b/test/test_py_d/ts_xmrwallet.py @@ -20,17 +20,31 @@ test.test_py_d.ts_xmrwallet: xmrwallet tests for the test.py test suite """ -import sys,os,atexit,asyncio,shutil +import sys,os,time,re,atexit,asyncio,shutil from subprocess import run,PIPE +from collections import namedtuple from mmgen.cfg import gc +from mmgen.util import msg,fmt,async_run,capfirst,is_int,die,list_gen from mmgen.obj import MMGenRange from mmgen.amt import XMRAmt from mmgen.addrlist import ViewKeyAddrList,KeyAddrList,AddrIdxList -from ..include.common import * -from .common import * -from .ts_base import * +from ..include.common import ( + cfg, + omsg, + oqmsg_r, + ok, + imsg, + imsg_r, + write_data_to_file, + read_from_file, + silence, + end_silence, + strip_ansi_escapes +) +from .common import get_file_with_ext +from .ts_base import TestSuiteBase # atexit functions: def stop_daemons(self): diff --git a/test/tooltest2.py b/test/tooltest2.py index 6abcecbd..8ee59658 100755 --- a/test/tooltest2.py +++ b/test/tooltest2.py @@ -36,9 +36,8 @@ from mmgen.color import green,blue,purple,cyan from mmgen.util import msg,msg_r,Msg,is_hex_str,async_run,die from mmgen.bip39 import is_bip39_mnemonic -from mmgen.baseconv import is_mmgen_mnemonic +from mmgen.baseconv import is_mmgen_mnemonic,is_b58_str from mmgen.xmrseed import is_xmrseed -from mmgen.baseconv import * skipped_tests = ['mn2hex_interactive'] diff --git a/test/unit_tests_d/ut_dep.py b/test/unit_tests_d/ut_dep.py index 07bf4249..cb5d856a 100755 --- a/test/unit_tests_d/ut_dep.py +++ b/test/unit_tests_d/ut_dep.py @@ -10,7 +10,7 @@ test.unit_tests_d.ut_dep: dependency unit tests for the MMGen suite from subprocess import run,PIPE from mmgen.cfg import gc -from mmgen.util import ymsg,gmsg +from mmgen.util import msg,ymsg,gmsg from mmgen.exception import NoLEDSupport from ..include.common import cfg,vmsg,check_solc_ver diff --git a/test/unit_tests_d/ut_xmrseed.py b/test/unit_tests_d/ut_xmrseed.py index e409edc2..f815a427 100755 --- a/test/unit_tests_d/ut_xmrseed.py +++ b/test/unit_tests_d/ut_xmrseed.py @@ -4,7 +4,7 @@ test/unit_tests_d/ut_xmrseed: Monero mnemonic unit test for the MMGen suite """ -from mmgen.util import msg,msg_r +from mmgen.util import msg,msg_r,ymsg from ..include.common import cfg,qmsg,vmsg