diff --git a/tests/run-tests.py b/tests/run-tests.py index c21f6df0a3..3f876e3ff4 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -841,8 +841,20 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): skip_tests = [os.path.realpath(base_path(skip_test)) for skip_test in skip_tests] def run_one_test(test_file): - test_file = test_file.replace("\\", "/") test_file_abspath = os.path.abspath(test_file).replace("\\", "/") + # If test_file is one of our own tests always make it relative to our tests/ dir and + # otherwise use the abosulte path, irregardless of actual path passed, + # such that display and result output is always the same. + try: + test_file_relpath = os.path.relpath(test_file, start=base_path()) + if not test_file_relpath.startswith(".."): + test_file = test_file_relpath + else: + test_file = test_file_abspath + except ValueError: + # Path on different drive on Windows. + test_file = test_file_abspath + test_file = test_file.replace("\\", "/") if args.filters: # Default verdict is the opposite of the first action