@@ -229,17 +229,19 @@ def retag_unittests(args):
229
229
parser = ArgumentParser ('mx python-retag-unittests' )
230
230
parser .add_argument ('--upload-results-to' )
231
231
parsed_args , remaining_args = parser .parse_known_args (args )
232
- with set_env (ENABLE_CPYTHON_TAGGED_UNITTESTS = "true" ):
233
- with _dev_pythonhome_context ():
234
- args = [
235
- '--experimental-options=true' ,
236
- '--python.CatchAllExceptions=true' ,
237
- '--python.WithThread=true' ,
238
- '--python.CAPI=' + _get_capi_home (),
239
- 'graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py' ,
240
- '--retag' ,
241
- ]
242
- mx .run ([python_gvm ()] + args + remaining_args )
232
+ env = os .environ .copy ()
233
+ env .update (
234
+ ENABLE_CPYTHON_TAGGED_UNITTESTS = "true" ,
235
+ PYTHONPATH = os .path .join (_dev_pythonhome (), 'lib-python/3' ),
236
+ )
237
+ args = [
238
+ '--experimental-options=true' ,
239
+ '--python.CatchAllExceptions=true' ,
240
+ '--python.WithThread=true' ,
241
+ 'graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py' ,
242
+ '--retag' ,
243
+ ]
244
+ mx .run ([python_gvm ()] + args + remaining_args , env = env )
243
245
if parsed_args .upload_results_to :
244
246
with tempfile .TemporaryDirectory (prefix = 'graalpython-retagger-' ) as d :
245
247
filename = os .path .join (d , 'unittest-tags-{}.tar.bz2' .format (sys .platform ))
@@ -439,12 +441,14 @@ def _graalpytest_root():
439
441
return os .path .join (SUITE .dir , "graalpython" , "com.oracle.graal.python.test" , "src" , "tests" )
440
442
441
443
442
- def run_python_unittests (python_binary , args = None , paths = None , aot_compatible = True , exclude = None ):
444
+ def run_python_unittests (python_binary , args = None , paths = None , aot_compatible = True , exclude = None , env = None ):
443
445
args = args or []
444
446
args = ["--experimental-options=true" ,
445
447
"--python.CatchAllExceptions=true" ] + args
446
448
exclude = exclude or []
447
449
paths = paths or [_graalpytest_root ()]
450
+ if env is None :
451
+ env = os .environ .copy ()
448
452
449
453
# list of excluded tests
450
454
if aot_compatible :
@@ -484,13 +488,13 @@ def is_included(path):
484
488
assert len (agent_args ) < 1024
485
489
# jacoco only dumps the data on exit, and when we run all our unittests
486
490
# at once it generates so much data we run out of heap space
487
- with set_env ( JAVA_TOOL_OPTIONS = agent_args ):
488
- for testfile in testfiles :
489
- mx .run ([python_binary ] + args + [testfile ], nonZeroIsFatal = True )
491
+ env [ ' JAVA_TOOL_OPTIONS' ] = agent_args
492
+ for testfile in testfiles :
493
+ mx .run ([python_binary ] + args + [testfile ], nonZeroIsFatal = True , env = env )
490
494
else :
491
495
args += testfiles
492
496
mx .logv (" " .join ([python_binary ] + args ))
493
- return mx .run ([python_binary ] + args , nonZeroIsFatal = True )
497
+ return mx .run ([python_binary ] + args , nonZeroIsFatal = True , env = env )
494
498
495
499
496
500
def graalpython_gate_runner (args , tasks ):
@@ -524,17 +528,19 @@ def graalpython_gate_runner(args, tasks):
524
528
525
529
with Task ('GraalPython Python tests' , tasks , tags = [GraalPythonTags .tagged ]) as task :
526
530
if task :
527
- with set_env (ENABLE_CPYTHON_TAGGED_UNITTESTS = "true" , ENABLE_THREADED_GRAALPYTEST = "true" ):
528
- # the tagged unittests must run in the dev_pythonhome and using
529
- # the dev CAPI, because that's where the tags are
530
- with _dev_pythonhome_context ():
531
- run_python_unittests (
532
- python_gvm (),
533
- args = ["-v" ,
534
- "--python.WithThread=true" ,
535
- "--python.CAPI=" + _get_capi_home ()],
536
- paths = ["test_tagged_unittests.py" ]
537
- )
531
+ env = os .environ .copy ()
532
+ env .update (
533
+ ENABLE_CPYTHON_TAGGED_UNITTESTS = "true" ,
534
+ ENABLE_THREADED_GRAALPYTEST = "true" ,
535
+ PYTHONPATH = os .path .join (_dev_pythonhome (), 'lib-python/3' ),
536
+ )
537
+ run_python_unittests (
538
+ python_gvm (),
539
+ args = ["-v" ,
540
+ "--python.WithThread=true" ],
541
+ paths = ["test_tagged_unittests.py" ],
542
+ env = env ,
543
+ )
538
544
539
545
# Unittests on SVM
540
546
with Task ('GraalPython tests on SVM' , tasks , tags = [GraalPythonTags .svmunit ]) as task :
0 commit comments