From 43684c8283c895236224e7f5b27ae02b7e46a8dc Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 24 Sep 2021 20:07:05 +0000 Subject: [PATCH] unit_tests.py: add --exclude option --- test/unit_tests.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/unit_tests.py b/test/unit_tests.py index ebfa25a4..5f20bcc5 100755 --- a/test/unit_tests.py +++ b/test/unit_tests.py @@ -39,6 +39,7 @@ opts_data = { -l, --list List available tests -n, --names Print command names instead of descriptions -q, --quiet Produce quieter output +-x, --exclude=T Exclude tests 'T' (comma-separated) -v, --verbose Produce more verbose output """, 'notes': """ @@ -59,6 +60,12 @@ def exit_msg(): all_tests = sorted( [fn[3:-3] for fn in os.listdir(os.path.join(repo_root,'test','unit_tests_d')) if fn[:3] == file_pfx]) +exclude = opt.exclude.split(',') if opt.exclude else [] + +for e in exclude: + if e not in all_tests: + die(1,f'{e!r}: invalid parameter for --exclude (no such test)') + start_time = int(time.time()) if opt.list: @@ -123,7 +130,8 @@ try: subtest = None if test not in all_tests: die(1,f'{test!r}: test not recognized') - run_test(test,subtest=subtest) + if test not in exclude: + run_test(test,subtest=subtest) exit_msg() except KeyboardInterrupt: die(1,green('\nExiting at user request'))