Skip to content

Commit c44f3f2

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 7be7e62 commit c44f3f2

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
@@ -528,6 +528,12 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
528528

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

539-
tests_dir = src_dir + '/test/functional/'
540-
541545
flags = ['--cachedir={}'.format(cache_dir)] + args
542546

543547
if enable_coverage:

0 commit comments

Comments
 (0)