@@ -222,10 +222,33 @@ def compare_unittests(args):
222222 mx .run ([sys .executable , "graalpython/com.oracle.graal.python.test/src/compare_unittests.py" , "-v" ] + args )
223223
224224
225+ def run_cpython_test (args ):
226+ import glob
227+ interp_args = []
228+ globs = []
229+ test_args = []
230+ for arg in args :
231+ if arg .startswith ("-" ):
232+ if not globs :
233+ interp_args .append (arg )
234+ else :
235+ test_args .append (arg )
236+ else :
237+ globs .append (arg )
238+ testfiles = []
239+ for g in globs :
240+ testfiles += glob .glob (os .path .join (SUITE .dir , "graalpython/lib-python/3/test" , f"{ g } *" ))
241+ mx .run ([python_gvm ()] + interp_args + [
242+ os .path .join (SUITE .dir , "graalpython/com.oracle.graal.python.test/src/tests/run_cpython_test.py" ),
243+ ] + test_args + testfiles )
244+
245+
225246def retag_unittests (args ):
226247 """run the cPython stdlib unittests"""
227248 parser = ArgumentParser ('mx python-retag-unittests' )
228249 parser .add_argument ('--upload-results-to' )
250+ parser .add_argument ('--inspect' , action = 'store_true' )
251+ parser .add_argument ('-debug-java' , action = 'store_true' )
229252 parsed_args , remaining_args = parser .parse_known_args (args )
230253 env = os .environ .copy ()
231254 env .update (
@@ -235,9 +258,14 @@ def retag_unittests(args):
235258 args = [
236259 '--experimental-options=true' ,
237260 '--python.CatchAllExceptions=true' ,
238- '--python.WithThread=true' ,
261+ '--python.WithThread=true' ]
262+ if parsed_args .inspect :
263+ args .append ('--inspect' )
264+ if parsed_args .debug_java :
265+ args .append ('-debug-java' )
266+ args += [
239267 'graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py' ,
240- '--retag' ,
268+ '--retag'
241269 ]
242270 mx .run ([python_gvm ()] + args + remaining_args , env = env )
243271 if parsed_args .upload_results_to :
@@ -1757,6 +1785,7 @@ def python_clean(args):
17571785 'python-unittests' : [python3_unittests , '' ],
17581786 'python-compare-unittests' : [compare_unittests , '' ],
17591787 'python-retag-unittests' : [retag_unittests , '' ],
1788+ 'python-run-cpython-unittest' : [run_cpython_test , 'test-name' ],
17601789 'python-update-unittest-tags' : [update_unittest_tags , '' ],
17611790 'python-import-for-graal' : [checkout_find_version_for_graalvm , '' ],
17621791 'nativebuild' : [nativebuild , '' ],
0 commit comments