test suite: import cleanups

This commit is contained in:
The MMGen Project 2023-10-03 14:27:57 +00:00
commit aff850d1c8
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
28 changed files with 67 additions and 20 deletions

View file

@ -25,7 +25,8 @@ mmgen-split: Split funds after a replayable chain fork using a timelocked transa
import time
from .common import *
from .cfg import Config
from .util import gmsg,die
opts_data = {
'text': {
@ -125,6 +126,7 @@ async def main():
gmsg(f'Creating timelocked transaction for long chain ({proto.coin})')
locktime = int(cfg.locktime)
if not locktime:
from .rpc import rpc_init
rpc = rpc_init(proto)
locktime = rpc.call('getblockcount')
tx1.create(mmids[0],locktime)

View file

@ -10,6 +10,7 @@ test/colortest.py: test color handling for the MMGen suite
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
def test_color():

View file

@ -13,7 +13,8 @@ test.include.coin_daemon_control: Start and stop daemons for the MMGen test suit
"""
import include.test_init
from mmgen.common import *
from mmgen.cfg import Config,gc
from mmgen.util import msg,die,oneshot_warning,async_run
from mmgen.protocol import init_proto
xmr_wallet_network_ids = {

View file

@ -20,9 +20,12 @@
test.include.common: Shared routines and data for the MMGen test suites
"""
import os
import sys,os
from subprocess import run,PIPE
from mmgen.common import *
from mmgen.cfg import gv
from mmgen.color import yellow,green,orange
from mmgen.util import msg,msg_r,Msg,Msg_r,gmsg,die
from mmgen.fileutil import write_data_to_file,get_data_from_file
def noop(*args,**kwargs):

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python3
from mmgen.common import *
import os
from mmgen.cfg import Config
from mmgen.util import msg
cfg = Config(process_opts=True)

View file

@ -5,7 +5,8 @@ pn = os.path.abspath(os.path.dirname(sys.argv[0]))
os.chdir(os.path.dirname(os.path.dirname(pn)))
sys.path[0] = os.curdir
from mmgen.common import *
from mmgen.cfg import Config,gc
from mmgen.util import msg
opts_data = {
'text': {
@ -43,6 +44,9 @@ def crypto():
msg(f'==> got hash preset: [{hp}]')
def seed():
from mmgen.wallet import Wallet
for n in range(1,3):
msg(f'------- NEW WALLET {n} -------\n')
w1 = Wallet(cfg)
@ -57,6 +61,4 @@ def seed():
w3 = Wallet(cfg,fn='test/ref/FE3C6545-D782B529[128,1].mmdat') # passphrase: 'reference password'
msg(f'\n==> got pw,preset,lbl: [{w3.ssdata.passwd}][{w3.ssdata.hash_preset}][{w3.ssdata.label}]\n')
from mmgen.wallet import Wallet
globals()[cfg._args[0]]()

View file

@ -5,7 +5,8 @@ import sys,os
os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(os.path.dirname(sys.argv[0])))))
sys.path[0] = os.curdir
from mmgen.common import *
from mmgen.cfg import Config
from mmgen.util import msg
opts_data = {
'text': {

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
from mmgen.common import *
from mmgen.cfg import Config
from mmgen.util import msg,oneshot_warning,oneshot_warning_group
cfg = Config()

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
from mmgen.common import *
from mmgen.cfg import Config
from mmgen.util import msg
opts_data = {
'sets': [('print_checksum',True,'quiet',True)],

View file

@ -6,7 +6,9 @@ parpar = os.path.dirname(os.path.dirname(pn))
os.chdir(parpar)
sys.path[0] = os.curdir
from mmgen.common import *
from mmgen.cfg import Config,gc
from mmgen.color import yellow,blue,cyan,set_vt100
from mmgen.util import msg,ymsg,gmsg,fmt,fmt_list,die
commands = [
'start',

View file

@ -89,8 +89,8 @@ else:
repo_root = include.test_init.repo_root
from mmgen.cfg import Config,gc
from mmgen.color import yellow,green,cyan
from mmgen.util import Msg,bmsg,die,suf,make_timestr
from mmgen.color import red,yellow,green,blue,cyan,nocolor
from mmgen.util import Msg,bmsg,die,suf,make_timestr,async_run
from test.include.common import (
set_globals,

View file

@ -21,9 +21,12 @@ test.test_py_d.common: Shared routines and data for the test.py test suite
"""
import sys,os
from mmgen.cfg import gc
from mmgen.color import green
from mmgen.util import msg
from ..include.common import *
from ..include.common import cfg,getrand,text_jp,text_zh,ascii_cyr_gr,lat_cyr_gr
rt_pw = 'abc-α'
ref_wallet_brainpass = 'abc'

View file

@ -25,6 +25,8 @@ from subprocess import run
from pathlib import Path
from mmgen.cfg import gc
from mmgen.color import red,green,blue,purple
from mmgen.util import suf
from ..include.common import *
from .common import *

View file

@ -10,11 +10,13 @@
test.test_py_d.ts_cfgfile: CfgFile tests for the MMGen test.py test suite
"""
import shutil
import time,shutil
from ..include.common import *
from .ts_base import *
from mmgen.cfgfile import *
from mmgen.color import yellow
class TestSuiteCfgFile(TestSuiteBase):
'CfgFile API'

View file

@ -26,6 +26,7 @@ from collections import namedtuple
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.protocol import CoinProtocol
from ..include.common import *

View file

@ -15,6 +15,8 @@ import time
from ..include.common import *
from .ts_base import *
from .input import *
from mmgen.util import capfirst,remove_whitespace
from mmgen.wallet import get_wallet_cls
class TestSuiteInput(TestSuiteBase):

View file

@ -20,6 +20,9 @@
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
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

View file

@ -20,6 +20,8 @@
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 *

View file

@ -21,6 +21,7 @@ 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 *

View file

@ -21,6 +21,7 @@ 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
from mmgen.wallet import get_wallet_cls
from ..include.common import *
from .common import *

View file

@ -21,6 +21,9 @@ test.test_py_d.ts_ref_altcoin: Altcoin reference file tests for the test.py test
"""
import os
from mmgen.color import set_vt100
from .common import *
from ..include.common import cfg
from .ts_ref import *

View file

@ -20,9 +20,9 @@
test.test_py_d.ts_regtest: Regtest tests for the test.py test suite
"""
import os,json,time
import os,json,time,re
from decimal import Decimal
from mmgen.util import die,gmsg
from mmgen.util import 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

View file

@ -21,6 +21,7 @@ test.test_py_d.ts_seedsplit: Seed split/join tests for the test.py test suite
"""
from mmgen.wallet import get_wallet_cls
from mmgen.util import capfirst
from .ts_base import *

View file

@ -21,7 +21,7 @@ test.test_py_d.ts_shared: Shared methods for the test.py test suite
"""
import os
from mmgen.util import ymsg
from mmgen.util import ymsg,get_extension
from mmgen.wallet import get_wallet_cls
from ..include.common import *

View file

@ -10,6 +10,9 @@
test.test_py_d.ts_tool: tool tests for the MMGen test.py test suite
"""
from mmgen.util import suf
from mmgen.color import cyan
from ..include.common import *
from .ts_base import *
from .ts_main import TestSuiteMain

View file

@ -21,6 +21,7 @@ test.test_py_d.ts_wallet: Wallet conversion tests for the test.py test suite
"""
import os
from mmgen.util import capfirst
from mmgen.wallet import get_wallet_cls
from .common import *
from .ts_base import *

View file

@ -29,8 +29,12 @@ from decimal import Decimal
import include.test_init
from mmgen.common import *
from test.include.common import set_globals,end_msg,sample_text
from mmgen.cfg import Config,gc
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.xmrseed import is_xmrseed

View file

@ -6,6 +6,7 @@ test/unit_tests_d/ut_tx_deserialize: TX deserialization unit tests for the MMGen
import os,json
from mmgen.color import purple,cyan
from mmgen.util import msg,Msg,Msg_r
from mmgen.protocol import init_proto
from mmgen.tx import CompletedTX