@@ -1450,15 +1450,12 @@ def python_coverage(args):
1450
1450
"--experimental-options" ,
1451
1451
"--coverage" ,
1452
1452
"--coverage.TrackInternal" ,
1453
- "--coverage.FilterFile=%s /lib-*python /*.%s" % ( prefix , pattern ) ,
1453
+ "--coverage.FilterFile=* /lib-*/*.%s" % pattern ,
1454
1454
"--coverage.Output=lcov" ,
1455
1455
"--coverage.OutputFile=%s" % outfile ,
1456
1456
]
1457
1457
env = os .environ .copy ()
1458
1458
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' )} "
1462
1459
if kwds .pop ("tagged" , False ):
1463
1460
run_tagged_unittests (executable , env = env )
1464
1461
else :
@@ -1499,9 +1496,16 @@ def python_coverage(args):
1499
1496
f .name
1500
1497
])
1501
1498
1499
+ home_launcher = os .path .join (os .path .dirname (os .path .dirname (executable )), 'jre/languages/python' )
1502
1500
# merge all generated lcov files
1503
1501
for f in os .listdir (SUITE .dir ):
1504
1502
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 )
1505
1509
cmdargs += ["-a" , f ]
1506
1510
1507
1511
mx .run (cmdargs )
0 commit comments