@@ -507,17 +507,30 @@ def process_event(self, event, out_file):
507
507
508
508
def run_in_subprocess_and_watch (self , tests : list [TestId ]):
509
509
conn , child_conn = multiprocessing .Pipe ()
510
- with tempfile .NamedTemporaryFile (prefix = 'graalpytest-out-' , mode = 'w+' ) as out_file :
510
+ with (
511
+ tempfile .NamedTemporaryFile (prefix = 'graalpytest-in-' , mode = 'w+' ) as tests_file ,
512
+ tempfile .NamedTemporaryFile (prefix = 'graalpytest-out-' , mode = 'w+' ) as out_file ,
513
+ ):
511
514
env = os .environ .copy ()
512
515
env ['IN_PROCESS' ] = '1'
513
516
remaining_tests = tests
514
517
while remaining_tests and not self .stop_event .is_set ():
515
518
self .last_out_pos = out_file .tell ()
516
519
python_args = ['-u' , * self .subprocess_args ]
517
- cmd = [sys .executable , * python_args , __file__ , '--pipe-fd' , str (child_conn .fileno ())]
520
+ cmd = [
521
+ sys .executable ,
522
+ * python_args ,
523
+ __file__ ,
524
+ '--pipe-fd' , str (child_conn .fileno ()),
525
+ '--tests-file' , tests_file .name ,
526
+ ]
518
527
if self .failfast :
519
528
cmd .append ('--failfast' )
520
- cmd += [str (s ) for s in remaining_tests ]
529
+ # We communicate the tests through a temp file to avoid running into too long commandlines on windows
530
+ tests_file .seek (0 )
531
+ tests_file .truncate ()
532
+ tests_file .write ('\n ' .join (map (str , remaining_tests )))
533
+ tests_file .flush ()
521
534
process = subprocess .Popen (
522
535
cmd ,
523
536
stdout = out_file ,
@@ -778,11 +791,17 @@ def loadTestsFromModule(self, module, *, pattern=None):
778
791
def in_process ():
779
792
parser = argparse .ArgumentParser ()
780
793
parser .add_argument ('--pipe-fd' , type = int , required = True )
794
+ parser .add_argument ('--tests-file' , type = Path , required = True )
781
795
parser .add_argument ('--failfast' , action = 'store_true' )
782
- parser .add_argument ('tests' , nargs = '*' , type = TestSpecifier .from_str )
783
796
args = parser .parse_args ()
797
+ tests = []
798
+ with open (args .tests_file ) as f :
799
+ for line in f :
800
+ tests .append (TestSpecifier .from_str (line .strip ()))
801
+
784
802
conn = multiprocessing .connection .Connection (args .pipe_fd )
785
- for test_suite in collect (args .tests ):
803
+
804
+ for test_suite in collect (tests ):
786
805
result = PipeResult (test_suite , conn )
787
806
result .failfast = args .failfast
788
807
test_suite .run (result )
0 commit comments