Skip to content

Commit cb7dc94

Browse files
committed
test: Explicitly specify directory where to search tests for
This change 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.
1 parent 2fd303f commit cb7dc94

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/functional/test_runner.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,12 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
524524

525525
# Test Framework Tests
526526
print("Running Unit Tests for Test Framework Modules")
527+
528+
tests_dir = src_dir + '/test/functional/'
529+
# This allows `test_runner.py` to work from an out-of-source build directory using a symlink,
530+
# a hard link or a copy on any platform. See https://github.com/bitcoin/bitcoin/pull/27561.
531+
sys.path.append(tests_dir)
532+
527533
test_framework_tests = unittest.TestSuite()
528534
for module in TEST_FRAMEWORK_MODULES:
529535
test_framework_tests.addTest(unittest.TestLoader().loadTestsFromName("test_framework.{}".format(module)))
@@ -532,8 +538,6 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
532538
logging.debug("Early exiting after failure in TestFramework unit tests")
533539
sys.exit(False)
534540

535-
tests_dir = src_dir + '/test/functional/'
536-
537541
flags = ['--cachedir={}'.format(cache_dir)] + args
538542

539543
if enable_coverage:

0 commit comments

Comments
 (0)