@@ -537,6 +537,24 @@ def is_included(path):
537
537
return mx .run ([python_binary ] + args , nonZeroIsFatal = True , env = env )
538
538
539
539
540
+ def run_tagged_unittests (python_binary , env = None ):
541
+ if env is None :
542
+ env = os .environ
543
+ env = env .copy ()
544
+ env .update (
545
+ ENABLE_CPYTHON_TAGGED_UNITTESTS = "true" ,
546
+ ENABLE_THREADED_GRAALPYTEST = "true" ,
547
+ PYTHONPATH = os .path .join (_dev_pythonhome (), 'lib-python/3' ),
548
+ )
549
+ run_python_unittests (
550
+ python_binary ,
551
+ args = ["-v" ,
552
+ "--python.WithThread=true" ],
553
+ paths = ["test_tagged_unittests.py" ],
554
+ env = env ,
555
+ )
556
+
557
+
540
558
def graalpython_gate_runner (args , tasks ):
541
559
# JUnit tests
542
560
with Task ('GraalPython JUnit' , tasks , tags = [GraalPythonTags .junit ]) as task :
@@ -568,19 +586,7 @@ def graalpython_gate_runner(args, tasks):
568
586
569
587
with Task ('GraalPython Python tests' , tasks , tags = [GraalPythonTags .tagged ]) as task :
570
588
if task :
571
- env = os .environ .copy ()
572
- env .update (
573
- ENABLE_CPYTHON_TAGGED_UNITTESTS = "true" ,
574
- ENABLE_THREADED_GRAALPYTEST = "true" ,
575
- PYTHONPATH = os .path .join (_dev_pythonhome (), 'lib-python/3' ),
576
- )
577
- run_python_unittests (
578
- python_gvm (),
579
- args = ["-v" ,
580
- "--python.WithThread=true" ],
581
- paths = ["test_tagged_unittests.py" ],
582
- env = env ,
583
- )
589
+ run_tagged_unittests (python_gvm ())
584
590
585
591
# Unittests on SVM
586
592
with Task ('GraalPython tests on SVM' , tasks , tags = [GraalPythonTags .svmunit ]) as task :
@@ -1424,11 +1430,7 @@ def python_coverage(args):
1424
1430
{"args" : []},
1425
1431
{"args" : ["--python.EmulateJython" ], "paths" : ["test_interop.py" ]},
1426
1432
# {"args": ["--llvm.managed"]},
1427
- {
1428
- "args" : ["-v" , "--python.WithThread=true" ],
1429
- "paths" : ["test_tagged_unittests.py" ],
1430
- "tagged" : True
1431
- },
1433
+ {"tagged" : True },
1432
1434
]
1433
1435
outputlcov = "coverage.lcov"
1434
1436
if os .path .exists (outputlcov ):
@@ -1442,20 +1444,21 @@ def python_coverage(args):
1442
1444
if os .path .exists (outfile ):
1443
1445
os .unlink (outfile )
1444
1446
extra_args = [
1447
+ "--experimental-options" ,
1445
1448
"--coverage" ,
1446
1449
"--coverage.TrackInternal" ,
1447
- "--coverage.FilterFile=%s/*.%s" % (prefix , pattern ),
1450
+ "--coverage.FilterFile=%s/lib-*python/ *.%s" % (prefix , pattern ),
1448
1451
"--coverage.Output=lcov" ,
1449
1452
"--coverage.OutputFile=%s" % outfile ,
1450
1453
]
1451
- with set_env ( GRAAL_PYTHON_ARGS = " " . join ( extra_args )):
1452
- with _dev_pythonhome_context (): # run all our tests in the dev-home, so that lcov has consistent paths
1453
- kwds [ "args" ]. append ( "--python.CAPI=" + _get_capi_home ())
1454
- if kwds . pop ( "tagged" , False ):
1455
- with set_env ( ENABLE_CPYTHON_TAGGED_UNITTESTS = "true " , ENABLE_THREADED_GRAALPYTEST = "true" ):
1456
- run_python_unittests (executable , ** kwds )
1457
- else :
1458
- run_python_unittests (executable , ** kwds )
1454
+ env = os . environ . copy ()
1455
+ env [ 'GRAAL_PYTHON_ARGS' ] = " " . join ( extra_args )
1456
+ # run all our tests in the dev-home, so that lcov has consistent paths
1457
+ env [ 'PYTHONPATH' ] = os . path . join ( _dev_pythonhome (), 'lib-python/3' )
1458
+ if kwds . pop ( "tagged " , False ):
1459
+ run_tagged_unittests (executable , env = env )
1460
+ else :
1461
+ run_python_unittests (executable , env = env , ** kwds )
1459
1462
1460
1463
# generate a synthetic lcov file that includes all sources with 0
1461
1464
# coverage. this is to ensure all sources actuall show up - otherwise,
0 commit comments