Skip to content

Commit

Permalink
test: Explicitly specify directory where to search tests for
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hebasto committed May 19, 2023
1 parent 2fd303f commit cb7dc94
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,12 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=

# 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)))
Expand All @@ -532,8 +538,6 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
logging.debug("Early exiting after failure in TestFramework unit tests")
sys.exit(False)

tests_dir = src_dir + '/test/functional/'

flags = ['--cachedir={}'.format(cache_dir)] + args

if enable_coverage:
Expand Down

0 comments on commit cb7dc94

Please sign in to comment.