diff options
author | fanquake <fanquake@gmail.com> | 2024-02-26 10:50:39 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2024-02-26 10:54:56 +0000 |
commit | edefcd51f7de3080fc5e35bc1a7a58f562cd029d (patch) | |
tree | bd605a4f73127737c29129eacc67900a7c9788e0 /test | |
parent | eaede2765593a854d92d67064cedb4cbd9bd4716 (diff) | |
parent | 5f240ab2e89fb20286fbaf9a1f00346bb1cad5a1 (diff) |
Merge bitcoin/bitcoin#29470: test: Add option to skip python unit tests
5f240ab2e89fb20286fbaf9a1f00346bb1cad5a1 test: Add option to skip unit tests for the test runner (Martin Zumsande)
Pull request description:
In the python `test_runner`, it's possible to disable specific functional tests (or just enable a few specific ones), but the unit tests for the python test framework cannot be skipped.
Add this option (`--skipunit` or `-u`), it would save some time for devs not interested in running those every time.
ACKs for top commit:
fjahr:
re-ACK 5f240ab2e89fb20286fbaf9a1f00346bb1cad5a1
tdb3:
Code review and tested ACK 5f240ab2e89fb20286fbaf9a1f00346bb1cad5a1
stratospher:
tested ACK 5f240ab.
Tree-SHA512: f7c9cfefc18a6510e24ca4601309b40fdf4180a4c5fe592be9cf7607be6541784b283c46c8d6e60740ff3eba83025dd5d0db36e55bf8bad1404b38120859e113
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/test_runner.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index e438a60edc..9f69fd898d 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -434,6 +434,8 @@ def main(): parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs") parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure') parser.add_argument('--filter', help='filter scripts to run by regular expression') + parser.add_argument('--skipunit', '-u', action='store_true', help='skip unit tests for the test framework') + args, unknown_args = parser.parse_known_args() if not args.ansi: @@ -544,9 +546,10 @@ def main(): combined_logs_len=args.combinedlogslen, failfast=args.failfast, use_term_control=args.ansi, + skipunit=args.skipunit, ) -def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control): +def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control, skipunit=False): args = args or [] # Warn if bitcoind is already running @@ -563,20 +566,20 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage= if os.path.isdir(cache_dir): print("%sWARNING!%s There is a cache directory here: %s. If tests fail unexpectedly, try deleting the cache directory." % (BOLD[1], BOLD[0], cache_dir)) - # Test Framework Tests - print("Running Unit Tests for Test Framework Modules") tests_dir = src_dir + '/test/functional/' # This allows `test_runner.py` to work from an out-of-source build directory using a symlink, # a hard link or a copy on any platform. See https://github.com/bitcoin/bitcoin/pull/27561. sys.path.append(tests_dir) - test_framework_tests = unittest.TestSuite() - for module in TEST_FRAMEWORK_MODULES: - test_framework_tests.addTest(unittest.TestLoader().loadTestsFromName("test_framework.{}".format(module))) - result = unittest.TextTestRunner(verbosity=1, failfast=True).run(test_framework_tests) - if not result.wasSuccessful(): - sys.exit("Early exiting after failure in TestFramework unit tests") + if not skipunit: + print("Running Unit Tests for Test Framework Modules") + test_framework_tests = unittest.TestSuite() + for module in TEST_FRAMEWORK_MODULES: + test_framework_tests.addTest(unittest.TestLoader().loadTestsFromName("test_framework.{}".format(module))) + result = unittest.TextTestRunner(verbosity=1, failfast=True).run(test_framework_tests) + if not result.wasSuccessful(): + sys.exit("Early exiting after failure in TestFramework unit tests") flags = ['--cachedir={}'.format(cache_dir)] + args |