unit_tests.py: add --no-altcoin-deps option; update in test-release.sh
This commit is contained in:
parent
bc439e0b3d
commit
5f22ded095
3 changed files with 20 additions and 12 deletions
|
|
@ -101,7 +101,7 @@ do
|
|||
echo
|
||||
echo " By default, all tests are run"
|
||||
exit ;;
|
||||
A) SKIP_ALT=1 ;;
|
||||
A) SKIP_ALT_DEP=1 unit_tests_py+=" --no-altcoin-deps";;
|
||||
b) test_py+=" --buf-keypress" ;;
|
||||
C) mkdir -p 'test/trace'
|
||||
touch 'test/trace.acc'
|
||||
|
|
@ -153,7 +153,7 @@ case $1 in
|
|||
'') tests=$dfl_tests ;;
|
||||
'default') tests=$dfl_tests ;;
|
||||
'extra') tests=$extra_tests ;;
|
||||
'noalt') tests=$noalt_tests SKIP_ALT=1 ;;
|
||||
'noalt') tests=$noalt_tests SKIP_ALT_DEP=1 ;;
|
||||
'quick') tests=$quick_tests ;;
|
||||
'qskip') tests=$qskip_tests ;;
|
||||
*) tests="$*" ;;
|
||||
|
|
@ -493,7 +493,7 @@ t_tool2="
|
|||
$tooltest2_py --fork # run once with --fork so commands are actually executed
|
||||
"
|
||||
f_tool2='tooltest2 tests completed'
|
||||
[ "$SKIP_ALT" ] && t_tool2_skip='17 18'
|
||||
[ "$SKIP_ALT_DEP" ] && t_tool2_skip='17 18'
|
||||
|
||||
i_tool='Tooltest'
|
||||
s_tool="The following tests will run '$tooltest_py' for all supported coins"
|
||||
|
|
|
|||
|
|
@ -30,14 +30,15 @@ opts_data = {
|
|||
'desc': "Unit tests for the MMGen suite",
|
||||
'usage':'[options] [test | test.subtest]...',
|
||||
'options': """
|
||||
-h, --help Print this help message
|
||||
-h, --help Print this help message
|
||||
-a, --no-altcoin-deps Skip tests requiring altcoin daemons, libs or utils
|
||||
-A, --no-daemon-autostart Don't start and stop daemons automatically
|
||||
-D, --no-daemon-stop Don't stop auto-started daemons after running tests
|
||||
-f, --fast Speed up execution by reducing rounds on some tests
|
||||
-l, --list List available tests
|
||||
-n, --names Print command names instead of descriptions
|
||||
-q, --quiet Produce quieter output
|
||||
-v, --verbose Produce more verbose output
|
||||
-D, --no-daemon-stop Don't stop auto-started daemons after running tests
|
||||
-f, --fast Speed up execution by reducing rounds on some tests
|
||||
-l, --list List available tests
|
||||
-n, --names Print command names instead of descriptions
|
||||
-q, --quiet Produce quieter output
|
||||
-v, --verbose Produce more verbose output
|
||||
""",
|
||||
'notes': """
|
||||
If no test is specified, all available tests are run
|
||||
|
|
@ -52,7 +53,8 @@ def exit_msg():
|
|||
t = int(time.time()) - start_time
|
||||
gmsg('All requested tests finished OK, elapsed time: {:02}:{:02}'.format(t//60,t%60))
|
||||
|
||||
all_tests = [fn[3:-3] for fn in os.listdir(os.path.join(repo_root,'test','unit_tests_d')) if fn[:3] == 'ut_']
|
||||
all_tests = sorted(
|
||||
[fn[3:-3] for fn in os.listdir(os.path.join(repo_root,'test','unit_tests_d')) if fn[:3] == 'ut_'])
|
||||
|
||||
start_time = int(time.time())
|
||||
|
||||
|
|
@ -97,10 +99,14 @@ def run_test(test,subtest=None):
|
|||
run_subtest(subtest)
|
||||
else:
|
||||
gmsg(f'Running unit test {test}')
|
||||
if hasattr(mod,'unit_tests'):
|
||||
if hasattr(mod,'unit_tests'): # new class-based API
|
||||
t = getattr(mod,'unit_tests')
|
||||
altcoin_deps = getattr(t,'altcoin_deps',())
|
||||
subtests = [k for k,v in t.__dict__.items() if type(v).__name__ == 'function']
|
||||
for subtest in subtests:
|
||||
if opt.no_altcoin_deps and subtest in altcoin_deps:
|
||||
qmsg(gray(f'Invoked with --no-altcoin-deps, so skipping {subtest!r}'))
|
||||
continue
|
||||
run_subtest(subtest)
|
||||
else:
|
||||
if not mod.unit_test().run_test(test,UnitTestHelpers):
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ def run_test(coin,auth):
|
|||
|
||||
class unit_tests:
|
||||
|
||||
altcoin_deps = ('bch','eth','xmr_wallet')
|
||||
|
||||
def bch(self,name,ut):
|
||||
return run_test('bch',auth=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue