From 40b2e871aa96af3102b53b61e0fc35d907d2f8b5 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 15 Aug 2026 14:13:08 +0000 Subject: [PATCH] test suite: minor fixes and cleanups --- pyproject.toml | 1 + test/cmdtest_d/tool.py | 16 +++++++------- test/test-release.d/cfg.sh | 43 ++++++++++++++++++-------------------- test/test-release.sh | 6 ++++-- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 90ee4dce..9f8c311a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,6 +80,7 @@ max-line-length = 106 [tool.pylint.main] recursive = true +errors-only = true jobs = 0 ignore = [ "data", diff --git a/test/cmdtest_d/tool.py b/test/cmdtest_d/tool.py index 44329ce9..90e9c1c9 100755 --- a/test/cmdtest_d/tool.py +++ b/test/cmdtest_d/tool.py @@ -33,7 +33,8 @@ class CmdTestTool(CmdTestMain, CmdTestBase): networks = ('btc',) segwit_opts_ok = False tmpdir_nums = [9] - enc_infn = 'tool_encrypt.in' + enc_in_fn = 'tool_encrypt.in' + dec_out_fn = 'tool_decrypt.out' cmd_group = ( ('tool_find_incog_data', (9, '‘mmgen-tool find_incog_data’', [[[hincog_fn], 1], [[incog_id_fn], 1]]) @@ -45,7 +46,7 @@ class CmdTestTool(CmdTestMain, CmdTestBase): (9, '‘mmgen-tool encrypt’ (random data)', []) ), ('tool_decrypt', - (9, '‘mmgen-tool decrypt’ (random data)', [[[enc_infn+'.mmenc'], 9]]) + (9, '‘mmgen-tool decrypt’ (random data)', [[[enc_in_fn+'.mmenc'], 9]]) ), ('tool_twview_bad_comment', (9, '‘mmgen-tool twview’ (with bad comment)', []) @@ -78,7 +79,7 @@ class CmdTestTool(CmdTestMain, CmdTestBase): return t def tool_encrypt(self): - infile = joinpath(self.tmpdir, self.enc_infn) + infile = joinpath(self.tmpdir, self.enc_in_fn) write_to_file(infile, getrand(1033), binary=True) t = self.spawn('mmgen-tool', ['-d', self.tmpdir, self.usr_rand_arg, 'encrypt', infile]) t.usr_rand(self.usr_rand_chars) @@ -88,12 +89,13 @@ class CmdTestTool(CmdTestMain, CmdTestBase): return t def tool_decrypt(self, f1): - out_fn = 'tool_encrypt.out' - t = self.spawn('mmgen-tool', ['-d', self.tmpdir, 'decrypt', f1, 'outfile='+out_fn, 'hash_preset=1']) + t = self.spawn( + 'mmgen-tool', + ['-d', self.tmpdir, 'decrypt', f1, 'outfile='+self.dec_out_fn, 'hash_preset=1']) t.passphrase('data', tool_enc_passwd) t.written_to_file('Decrypted data') - d1 = self.read_from_tmpfile(self.enc_infn, binary=True) - d2 = self.read_from_tmpfile(out_fn, binary=True) + d1 = self.read_from_tmpfile(self.enc_in_fn, binary=True) + d2 = self.read_from_tmpfile(self.dec_out_fn, binary=True) cmp_or_die(d1, d2) return t diff --git a/test/test-release.d/cfg.sh b/test/test-release.d/cfg.sh index 45ae9391..d1576f4b 100755 --- a/test/test-release.d/cfg.sh +++ b/test/test-release.d/cfg.sh @@ -8,7 +8,7 @@ # https://github.com/mmgen/mmgen-wallet # https://gitlab.com/mmgen/mmgen-wallet -all_tests="dep dev lint obj color daemon mod hash ref altref altgen xmr geth reth autosign btc btc_tn btc_rt bch bch_tn bch_rt ltc ltc_tn ltc_rt tool tool2 gen alt help" +all_tests="dep dev ruff pylint obj color daemon mod hash ref altref altgen xmr geth reth autosign btc btc_tn btc_rt bch bch_tn bch_rt ltc ltc_tn ltc_rt tool tool2 gen alt help" groups_desc=" default - All tests minus the extra tests @@ -20,11 +20,11 @@ groups_desc=" init_groups() { dfl_tests='dep daemon alt obj color mod hash ref tool tool2 gen help autosign btc btc_tn btc_rt altref altgen bch bch_rt ltc ltc_rt geth reth etc rune xmr' - extra_tests='dep dev lint pylint autosign_live ltc_tn bch_tn' + extra_tests='dep dev ruff pylint autosign_live ltc_tn bch_tn' noalt_tests='dep daemon alt obj color mod hash ref tool tool2 gen help autosign btc btc_tn btc_rt' quick_tests='dep daemon alt obj color mod hash ref tool tool2 gen help autosign btc btc_rt altref altgen geth etc rune xmr' - qskip_tests='lint btc_tn bch bch_rt ltc ltc_rt' - noalt_ok_tests='lint' + qskip_tests='ruff btc_tn bch bch_rt ltc ltc_rt' + noalt_ok_tests='ruff' [ "$MSYS2" ] && SKIP_LIST='autosign autosign_live' [ "$SKIP_PARITY" ] && SKIP_LIST+=' etc' @@ -71,28 +71,25 @@ init_tests() { - $cmdtest_py dev " - [ "$VERBOSE" ] || STDOUT_DEVNULL='> /dev/null' - d_lint="code errors with Ruff static code analyzer" - e_lint="Error checking failed!" - t_lint=" - b ruff check setup.py $STDOUT_DEVNULL - b ruff check mmgen $STDOUT_DEVNULL - b ruff check test $STDOUT_DEVNULL - b ruff check examples $STDOUT_DEVNULL + d_ruff="code errors with Ruff static analyzer" + e_ruff="Error checking failed!" + t_ruff=" + b $ruff check setup.py + b $ruff check mmgen + b $ruff check test + b $ruff check examples " - PYLINT_OPTS='--errors-only --jobs=0' - d_pylint="code errors with Pylint static code analyzer" + d_pylint="code errors with Pylint static analyzer" e_pylint="Error checking failed!" - # use pylint==3.1.1 t_pylint=" - b $pylint $PYLINT_OPTS mmgen - 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 '.*/dep.py,.*/testdep.py' test - a $pylint $PYLINT_OPTS --ignore-paths '.*/ethdev.py' --disable=relative-beyond-top-level test/cmdtest_d - - $pylint $PYLINT_OPTS examples + b $pylint mmgen + b $pylint test + b $pylint --disable=relative-beyond-top-level test/cmdtest_d + a $pylint --ignore-paths '.*/eth/.*' mmgen + a $pylint --ignore-paths '.*/dep.py,.*/testdep.py' test + a $pylint --ignore-paths '.*/ethdev.py' --disable=relative-beyond-top-level test/cmdtest_d + - $pylint examples " if [ "$SKIP_ALT_DEP" ]; then t_pylint_skip='b'; else t_pylint_skip='a'; fi @@ -105,7 +102,7 @@ init_tests() { d_hash="internal hash function implementations" t_hash=" 256 $python test/hashfunc.py sha256 $rounds5x - 512 $python test/hashfunc.py sha512 $rounds5x # native SHA512 - not used by the MMGen wallet + 512 $python test/hashfunc.py sha512 $rounds5x # internal SHA512 not used by MMGen Wallet keccak $python test/hashfunc.py keccak $rounds5x ripemd160 $python mmgen/contrib/ripemd160.py $VERBOSE $fast_opt " diff --git a/test/test-release.sh b/test/test-release.sh index 18e1db23..e287309f 100755 --- a/test/test-release.sh +++ b/test/test-release.sh @@ -65,7 +65,7 @@ list_avail_tests() { [ "$a" ] && printf " %-8s - %s\n" $a "$c" done <<<$groups_desc echo - echo "By default, all tests are run" + echo "By default, all tests in default or specified test group are run" } run_tests() { @@ -277,7 +277,8 @@ gentest_py='test/gentest.py --quiet' scrambletest_py='test/scrambletest.py' altcoin_mod_opts='--quiet' mmgen_tool='cmds/mmgen-tool' -pylint='PYTHONPATH=. pylint' # PYTHONPATH required by older Pythons (e.g. v3.9) +pylint='pylint' +ruff='ruff --silent' python='python3' rounds=10 typescript_file='test-release.out' @@ -373,6 +374,7 @@ do mmgen_tool+=" --verbose" objattrtest_py+=" --verbose" pylint+=" --verbose" + ruff="${ruff/' --silent'}" scrambletest_py+=" --verbose" ;; X) IN_REEXEC=1 ;; *) exit ;;