Browse Source

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

The MMGen Project 2 weeks ago
parent
commit
8b504c895a

+ 5 - 5
pyproject.toml

@@ -36,10 +36,10 @@ ignore = [
 ]
 ]
 "test/include/common.py"        = [ "F821" ]         # undefined name 'cfg'
 "test/include/common.py"        = [ "F821" ]         # undefined name 'cfg'
 "test/misc/input_func.py"       = [ "F401" ]         # imported but unused
 "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/objtest_d/*"              = [ "F401" ]         # imported but unused
 "test/objattrtest_d/*"          = [ "F401" ]         # imported but unused
 "test/objattrtest_d/*"          = [ "F401" ]         # imported but unused
 "test/overlay/fakemods/*"       = [ "F403", "F405" ] # `import *` used
 "test/overlay/fakemods/*"       = [ "F403", "F405" ] # `import *` used
@@ -61,7 +61,7 @@ ignore = [
 	"pyethereum",
 	"pyethereum",
 	"rlp",
 	"rlp",
 	"main_split.py",
 	"main_split.py",
-	"ut_tx.py",
+	"tx.py",
 ]
 ]
 ignored-modules = [ # ignored for no-member, otherwise checked
 ignored-modules = [ # ignored for no-member, otherwise checked
 	"mmgen.proto.secp256k1.secp256k1",
 	"mmgen.proto.secp256k1.secp256k1",

+ 1 - 1
test/daemontest_d/ut_exec.py → test/daemontest_d/exec.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from subprocess import run, PIPE

+ 1 - 1
test/daemontest_d/ut_msg.py → test/daemontest_d/msg.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 import os

+ 1 - 1
test/daemontest_d/ut_rpc.py → test/daemontest_d/rpc.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 import sys, os

+ 1 - 1
test/daemontest_d/ut_tx.py → test/daemontest_d/tx.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 import json

+ 3 - 5
test/include/unit_test.py

@@ -77,8 +77,6 @@ type(cfg)._reset_ok += ('use_internal_keccak_module', 'debug_addrlist')
 
 
 set_globals(cfg)
 set_globals(cfg)
 
 
-file_pfx = 'ut_'
-
 test_type = {
 test_type = {
 	'modtest.py':    'unit',
 	'modtest.py':    'unit',
 	'daemontest.py': 'daemon',
 	'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)
 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 []
 exclude = cfg.exclude.split(',') if cfg.exclude else []
 
 
@@ -105,7 +103,7 @@ if cfg.list:
 if cfg.list_subtests:
 if cfg.list_subtests:
 	def gen():
 	def gen():
 		for test in all_tests:
 		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'):
 			if hasattr(mod, 'unit_tests'):
 				t = getattr(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] != '_']
 				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 = []
 tests_seen = []
 
 
 def run_test(test, subtest=None):
 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):
 	def run_subtest(t, subtest):
 		subtest_disp = subtest.replace('_', '-')
 		subtest_disp = subtest.replace('_', '-')

+ 1 - 1
test/modtest_d/ut_addrlist.py → test/modtest_d/addrlist.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.color import blue

+ 2 - 2
test/modtest_d/ut_addrparse.py → test/modtest_d/addrparse.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.color import yellow, cyan
@@ -21,7 +21,7 @@ vectors = {
 		{'std': 'ltc1qvmqas4maw7lg9clqu6kqu9zq9cluvllnst5pxs'}
 		{'std': 'ltc1qvmqas4maw7lg9clqu6kqu9zq9cluvllnst5pxs'}
 	],
 	],
 	'xmr_mainnet': [
 	'xmr_mainnet': [
-		{ # ut_xmrseed.vectors[0]:
+		{ # xmrseed.vectors[0]:
 		'std': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm',
 		'std': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm',
 		# https://github.com/monero-project/monero/tests/functional_tests/integrated_address.py
 		# https://github.com/monero-project/monero/tests/functional_tests/integrated_address.py
 		'int': '4CMe2PUhs4J4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfSbLRB61BQVATzerHGj',
 		'int': '4CMe2PUhs4J4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfSbLRB61BQVATzerHGj',

+ 1 - 1
test/modtest_d/ut_amt.py → test/modtest_d/amt.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from decimal import Decimal

+ 1 - 1
test/modtest_d/ut_baseconv.py → test/modtest_d/baseconv.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.util import msg, msg_r

+ 1 - 1
test/modtest_d/ut_bip39.py → test/modtest_d/bip39.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.color import blue, orange, purple

+ 1 - 1
test/modtest_d/ut_bip_hd.py → test/modtest_d/bip_hd.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.color import gray, pink, blue

+ 1 - 1
test/modtest_d/ut_cashaddr.py → test/modtest_d/cashaddr.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 altcoin_dep = True

+ 1 - 1
test/modtest_d/ut_dep.py → test/modtest_d/dep.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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.
   Test whether dependencies are installed and functional.
   No data verification is performed.
   No data verification is performed.

+ 1 - 1
test/modtest_d/ut_devtools.py → test/modtest_d/devtools.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 import os, json

+ 1 - 1
test/modtest_d/ut_ecc.py → test/modtest_d/ecc.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.proto.secp256k1.secp256k1 import pubkey_gen, pubkey_tweak_add, pubkey_check

+ 1 - 1
test/modtest_d/ut_flags.py → test/modtest_d/flags.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.flags import ClassOpts, ClassFlags

+ 1 - 1
test/modtest_d/ut_gen.py → test/modtest_d/gen.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.color import blue

+ 1 - 1
test/modtest_d/ut_indexed_dict.py → test/modtest_d/indexed_dict.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.util import msg, msg_r, die

+ 1 - 1
test/modtest_d/ut_lockable.py → test/modtest_d/lockable.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from decimal import Decimal

+ 1 - 1
test/modtest_d/ut_misc.py → test/modtest_d/misc.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 import re, time

+ 1 - 1
test/modtest_d/ut_mn_entry.py → test/modtest_d/mn_entry.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.mn_entry import mn_entry

+ 1 - 1
test/modtest_d/ut_obj.py → test/modtest_d/obj.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from decimal import Decimal, getcontext

+ 1 - 1
test/modtest_d/ut_scrypt.py → test/modtest_d/scrypt.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.util import msg, msg_r

+ 1 - 1
test/modtest_d/ut_seedsplit.py → test/modtest_d/seedsplit.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.util import msg, msg_r

+ 1 - 1
test/modtest_d/ut_subseed.py → test/modtest_d/subseed.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.util import msg, msg_r

+ 1 - 1
test/modtest_d/ut_testdep.py → test/modtest_d/testdep.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 import os

+ 1 - 1
test/modtest_d/ut_tx.py → test/modtest_d/tx.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 import os

+ 1 - 1
test/modtest_d/ut_util.py → test/modtest_d/util.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 from mmgen.color import cyan

+ 1 - 1
test/modtest_d/ut_xmrseed.py → test/modtest_d/xmrseed.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 #!/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
 altcoin_dep = True

+ 1 - 1
test/test-release.d/cfg.sh

@@ -89,7 +89,7 @@ init_tests() {
 		b $pylint $PYLINT_OPTS test
 		b $pylint $PYLINT_OPTS test
 		b $pylint $PYLINT_OPTS --disable=relative-beyond-top-level test/cmdtest_d
 		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 '.*/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
 		a $pylint $PYLINT_OPTS --ignore-paths '.*/ct_ethdev.py' --disable=relative-beyond-top-level test/cmdtest_d
 		- $pylint $PYLINT_OPTS examples
 		- $pylint $PYLINT_OPTS examples
 	"
 	"

+ 9 - 9
test/tooltest2_d/data.py

@@ -23,9 +23,9 @@ from mmgen.bip39 import is_bip39_mnemonic
 from mmgen.baseconv import is_mmgen_mnemonic, is_b58_str
 from mmgen.baseconv import is_mmgen_mnemonic, is_b58_str
 from mmgen.xmrseed import is_xmrseed
 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
 from ..include.common import cfg, sample_text
 proto = cfg._proto
 proto = cfg._proto
@@ -110,14 +110,14 @@ zec_pubhex1 = 'e6a4edbff547f21bcc2a825b6cf70f06e266a452d2da9d6dc5c1da3d99d7e996f
 tests = {
 tests = {
 	'Mnemonic': {
 	'Mnemonic': {
 		'hex2mn': (
 		'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': (
 		'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': [
 		'mn_rand128': [
 			([], is_mmgen_mnemonic, ['-r0']),
 			([], is_mmgen_mnemonic, ['-r0']),