modtest.py, daemontest.py: remove prefixes from test files

This commit is contained in:
The MMGen Project 2025-03-17 18:29:11 +03:00
commit 8b504c895a
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
32 changed files with 47 additions and 49 deletions

View file

@ -36,10 +36,10 @@ ignore = [
]
"test/include/common.py" = [ "F821" ] # undefined name 'cfg'
"test/misc/input_func.py" = [ "F401" ] # imported but unused
"test/modtest_d/ut_cashaddr.py" = [ "F841" ] # assigned to but never used
"test/modtest_d/ut_dep.py" = [ "F401" ] # imported but unused
"test/modtest_d/ut_testdep.py" = [ "F401" ] # imported but unused
"test/modtest_d/ut_obj.py" = [ "F841" ] # assigned to but never used
"test/modtest_d/cashaddr.py" = [ "F841" ] # assigned to but never used
"test/modtest_d/dep.py" = [ "F401" ] # imported but unused
"test/modtest_d/testdep.py" = [ "F401" ] # imported but unused
"test/modtest_d/obj.py" = [ "F841" ] # assigned to but never used
"test/objtest_d/*" = [ "F401" ] # imported but unused
"test/objattrtest_d/*" = [ "F401" ] # imported but unused
"test/overlay/fakemods/*" = [ "F403", "F405" ] # `import *` used
@ -61,7 +61,7 @@ ignore = [
"pyethereum",
"rlp",
"main_split.py",
"ut_tx.py",
"tx.py",
]
ignored-modules = [ # ignored for no-member, otherwise checked
"mmgen.proto.secp256k1.secp256k1",

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.daemontest_d.ut_exec: unit test for the MMGen suite's Daemon class
test.daemontest_d.exec: unit test for the MMGen suite's Daemon class
"""
from subprocess import run, PIPE

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.daemontest_d.ut_msg: message signing unit tests for the MMGen suite
test.daemontest_d.msg: message signing unit tests for the MMGen suite
"""
import os

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.daemontest_d.ut_rpc: RPC unit test for the MMGen suite
test.daemontest_d.rpc: RPC unit test for the MMGen suite
"""
import sys, os

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.daemontest_d.ut_tx: TX daemon tests for the MMGen suite
test.daemontest_d.tx: TX daemon tests for the MMGen suite
"""
import json

View file

@ -77,8 +77,6 @@ type(cfg)._reset_ok += ('use_internal_keccak_module', 'debug_addrlist')
set_globals(cfg)
file_pfx = 'ut_'
test_type = {
'modtest.py': 'unit',
'daemontest.py': 'daemon',
@ -88,7 +86,7 @@ test_subdir = gc.prog_name.removesuffix('.py') + '_d'
test_dir = os.path.join(repo_root, 'test', test_subdir)
all_tests = sorted(fn[len(file_pfx):-len('.py')] for fn in os.listdir(test_dir) if fn.startswith(file_pfx))
all_tests = sorted(fn.removesuffix('.py') for fn in os.listdir(test_dir) if not fn.startswith('_'))
exclude = cfg.exclude.split(',') if cfg.exclude else []
@ -105,7 +103,7 @@ if cfg.list:
if cfg.list_subtests:
def gen():
for test in all_tests:
mod = importlib.import_module(f'test.{test_subdir}.{file_pfx}{test}')
mod = importlib.import_module(f'test.{test_subdir}.{test}')
if hasattr(mod, 'unit_tests'):
t = getattr(mod, 'unit_tests')
subtests = [k for k, v in t.__dict__.items() if type(v).__name__ == 'function' and k[0] != '_']
@ -154,7 +152,7 @@ class UnitTestHelpers:
tests_seen = []
def run_test(test, subtest=None):
mod = importlib.import_module(f'test.{test_subdir}.{file_pfx}{test}')
mod = importlib.import_module(f'test.{test_subdir}.{test}')
def run_subtest(t, subtest):
subtest_disp = subtest.replace('_', '-')

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_addrlist: address list unit tests for the MMGen suite
test.modtest_d.addrlist: address list unit tests for the MMGen suite
"""
from mmgen.color import blue

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_addrparse: address parsing tests for the MMGen suite
test.modtest_d.addrparse: address parsing tests for the MMGen suite
"""
from mmgen.color import yellow, cyan
@ -21,7 +21,7 @@ vectors = {
{'std': 'ltc1qvmqas4maw7lg9clqu6kqu9zq9cluvllnst5pxs'}
],
'xmr_mainnet': [
{ # ut_xmrseed.vectors[0]:
{ # xmrseed.vectors[0]:
'std': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm',
# https://github.com/monero-project/monero/tests/functional_tests/integrated_address.py
'int': '4CMe2PUhs4J4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfSbLRB61BQVATzerHGj',

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_amt: CoinAmt unit tests for the MMGen suite
test.modtest_d.amt: CoinAmt unit tests for the MMGen suite
"""
from decimal import Decimal

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_baseconv: Base conversion unit test for the MMGen suite
test.modtest_d.baseconv: Base conversion unit test for the MMGen suite
"""
from mmgen.util import msg, msg_r

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_bip39: BIP39 unit test for the MMGen suite
test.modtest_d.bip39: BIP39 unit test for the MMGen suite
"""
from mmgen.color import blue, orange, purple

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_bip_hd: bip_hd unit test for the MMGen suite
test.modtest_d.bip_hd: bip_hd unit test for the MMGen suite
"""
from mmgen.color import gray, pink, blue

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_cashaddr: unit test for the BCH cashaddr module
test.modtest_d.cashaddr: unit test for the BCH cashaddr module
"""
altcoin_dep = True

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_dep: dependency unit tests for the MMGen suite
test.modtest_d.dep: dependency unit tests for the MMGen suite
Test whether dependencies are installed and functional.
No data verification is performed.

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_devtools: devtools unit tests for the MMGen suite
test.modtest_d.devtools: devtools unit tests for the MMGen suite
"""
import os, json

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_ecc: elliptic curve unit test for the MMGen suite
test.modtest_d.ecc: elliptic curve unit test for the MMGen suite
"""
from mmgen.proto.secp256k1.secp256k1 import pubkey_gen, pubkey_tweak_add, pubkey_check

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_flags: unit test for the MMGen suite's ClassFlags class
test.modtest_d.flags: unit test for the MMGen suite's ClassFlags class
"""
from mmgen.flags import ClassOpts, ClassFlags

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_gen: key/address generation unit tests for the MMGen suite
test.modtest_d.gen: key/address generation unit tests for the MMGen suite
"""
from mmgen.color import blue

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_indexed_dict: IndexedDict class unit test for the MMGen suite
test.modtest_d.indexed_dict: IndexedDict class unit test for the MMGen suite
"""
from mmgen.util import msg, msg_r, die

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_lockable: unit test for the MMGen suite's Lockable class
test.modtest_d.lockable: unit test for the MMGen suite's Lockable class
"""
from decimal import Decimal

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_misc: miscellaneous unit tests for the MMGen suite
test.modtest_d.misc: miscellaneous unit tests for the MMGen suite
"""
import re, time

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_mn_entry: Mnemonic user entry unit test for the MMGen suite
test.modtest_d.mn_entry: Mnemonic user entry unit test for the MMGen suite
"""
from mmgen.mn_entry import mn_entry

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_obj: data object unit tests for the MMGen suite
test.modtest_d.obj: data object unit tests for the MMGen suite
"""
from decimal import Decimal, getcontext

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_scrypt: password hashing unit test for the MMGen suite
test.modtest_d.scrypt: password hashing unit test for the MMGen suite
"""
from mmgen.util import msg, msg_r

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_seedsplit: seed splitting unit test for the MMGen suite
test.modtest_d.seedsplit: seed splitting unit test for the MMGen suite
"""
from mmgen.util import msg, msg_r

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_subseed: subseed unit test for the MMGen suite
test.modtest_d.subseed: subseed unit test for the MMGen suite
"""
from mmgen.util import msg, msg_r

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_testdep: test dependency unit tests for the MMGen suite
test.modtest_d.testdep: test dependency unit tests for the MMGen suite
"""
import os

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_tx: TX unit tests for the MMGen suite
test.modtest_d.tx: TX unit tests for the MMGen suite
"""
import os

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_misc: utility unit tests for the MMGen suite
test.modtest_d.misc: utility unit tests for the MMGen suite
"""
from mmgen.color import cyan

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
test.modtest_d.ut_xmrseed: Monero mnemonic unit test for the MMGen suite
test.modtest_d.xmrseed: Monero mnemonic unit test for the MMGen suite
"""
altcoin_dep = True

View file

@ -89,7 +89,7 @@ init_tests() {
b $pylint $PYLINT_OPTS test
b $pylint $PYLINT_OPTS --disable=relative-beyond-top-level test/cmdtest_d
a $pylint $PYLINT_OPTS --ignore-paths '.*/eth/.*' mmgen
a $pylint $PYLINT_OPTS --ignore-paths '.*/ut_dep.py,.*/ut_testdep.py' test
a $pylint $PYLINT_OPTS --ignore-paths '.*/dep.py,.*/testdep.py' test
a $pylint $PYLINT_OPTS --ignore-paths '.*/ct_ethdev.py' --disable=relative-beyond-top-level test/cmdtest_d
- $pylint $PYLINT_OPTS examples
"

View file

@ -23,9 +23,9 @@ from mmgen.bip39 import is_bip39_mnemonic
from mmgen.baseconv import is_mmgen_mnemonic, is_b58_str
from mmgen.xmrseed import is_xmrseed
from ..modtest_d.ut_baseconv import unit_test as ut_baseconv
from ..modtest_d.ut_bip39 import unit_tests as ut_bip39
from ..modtest_d.ut_xmrseed import unit_tests as ut_xmrseed
from ..modtest_d.baseconv import unit_test as baseconv
from ..modtest_d.bip39 import unit_tests as bip39
from ..modtest_d.xmrseed import unit_tests as xmrseed
from ..include.common import cfg, sample_text
proto = cfg._proto
@ -110,14 +110,14 @@ zec_pubhex1 = 'e6a4edbff547f21bcc2a825b6cf70f06e266a452d2da9d6dc5c1da3d99d7e996f
tests = {
'Mnemonic': {
'hex2mn': (
[([a[0]], b) for a, b in ut_baseconv.vectors['mmgen']] +
[([a, 'fmt=bip39'], b) for a, b in ut_bip39.vectors] +
[([a, 'fmt=xmrseed'], b) for a, b in ut_xmrseed.vectors]
[([a[0]], b) for a, b in baseconv.vectors['mmgen']] +
[([a, 'fmt=bip39'], b) for a, b in bip39.vectors] +
[([a, 'fmt=xmrseed'], b) for a, b in xmrseed.vectors]
),
'mn2hex': (
[([b, 'fmt=mmgen'], a[0]) for a, b in ut_baseconv.vectors['mmgen']] +
[([b, 'fmt=bip39'], a) for a, b in ut_bip39.vectors] +
[([b, 'fmt=xmrseed'], a) for a, b in ut_xmrseed.vectors]
[([b, 'fmt=mmgen'], a[0]) for a, b in baseconv.vectors['mmgen']] +
[([b, 'fmt=bip39'], a) for a, b in bip39.vectors] +
[([b, 'fmt=xmrseed'], a) for a, b in xmrseed.vectors]
),
'mn_rand128': [
([], is_mmgen_mnemonic, ['-r0']),