Skip to content

Commit f955ada

Browse files
committed
Normalize coverage paths
1 parent 01b36fb commit f955ada

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,15 +1450,12 @@ def python_coverage(args):
14501450
"--experimental-options",
14511451
"--coverage",
14521452
"--coverage.TrackInternal",
1453-
"--coverage.FilterFile=%s/lib-*python/*.%s" % (prefix, pattern),
1453+
"--coverage.FilterFile=*/lib-*/*.%s" % pattern,
14541454
"--coverage.Output=lcov",
14551455
"--coverage.OutputFile=%s" % outfile,
14561456
]
14571457
env = os.environ.copy()
14581458
env['GRAAL_PYTHON_ARGS'] = " ".join(extra_args)
1459-
# run all our tests in the dev-home, so that lcov has consistent paths
1460-
# TODO tests with virtualenv won't pick this up
1461-
env['PYTHONPATH'] = f"{os.path.join(_dev_pythonhome(), 'lib-python/3')}:{os.path.join(_dev_pythonhome(), 'lib-graalpython')}"
14621459
if kwds.pop("tagged", False):
14631460
run_tagged_unittests(executable, env=env)
14641461
else:
@@ -1499,9 +1496,16 @@ def python_coverage(args):
14991496
f.name
15001497
])
15011498

1499+
home_launcher = os.path.join(os.path.dirname(os.path.dirname(executable)), 'jre/languages/python')
15021500
# merge all generated lcov files
15031501
for f in os.listdir(SUITE.dir):
15041502
if f.endswith(".lcov") and os.path.getsize(f):
1503+
# Normalize lib-graalpython path
1504+
with open(f) as lcov_file:
1505+
lcov = lcov_file.read()
1506+
lcov = lcov.replace(home_launcher, prefix)
1507+
with open(f, 'w') as lcov_file:
1508+
lcov_file.write(lcov)
15051509
cmdargs += ["-a", f]
15061510

15071511
mx.run(cmdargs)

0 commit comments

Comments
 (0)