@@ -346,9 +346,11 @@ def dump_truffle_ast(func):
346
346
pass
347
347
348
348
349
- class TestCase (object ):
350
- fail_fast = os .environ .get (b"GRAALPYTEST_FAIL_FAST" , "" ) == b"true"
349
+ fail_fast = os .environ .get (b"GRAALPYTEST_FAIL_FAST" , "" ) == b"true"
350
+ exitting = False
351
+
351
352
353
+ class TestCase (object ):
352
354
def __init__ (self ):
353
355
self .exceptions = []
354
356
self .passed = 0
@@ -412,7 +414,6 @@ def run_safely(self, func, print_immediately=False):
412
414
else :
413
415
return True
414
416
415
-
416
417
def run_test (self , func ):
417
418
if "test_main" in str (func ):
418
419
pass
@@ -453,13 +454,16 @@ def do_run():
453
454
do_run ()
454
455
else :
455
456
self .failure (func , end )
456
- if TestCase .fail_fast :
457
- if verbose :
458
- print (FAIL , BOLD )
459
- print ("\n Failing fast since GRAALPYTEST_FAIL_FAST is set ..." )
460
- if verbose :
461
- print (ENDC )
462
- sys .exit (1 )
457
+ if fail_fast :
458
+ global exitting
459
+ if not exitting :
460
+ exitting = True
461
+ if verbose :
462
+ print (FAIL , BOLD )
463
+ print ("\n Failing fast since GRAALPYTEST_FAIL_FAST is set ..." )
464
+ if verbose :
465
+ print (ENDC )
466
+ return
463
467
force_serial_execution = any (name in func .__qualname__ for name in SERIAL_TESTS )
464
468
if force_serial_execution :
465
469
ThreadPool .shutdown ()
@@ -640,6 +644,8 @@ def run(cls, items=None):
640
644
if not instance .run_safely (instance .setUpClass , print_immediately = True ):
641
645
return instance
642
646
for k , v in items :
647
+ if exitting :
648
+ break
643
649
if k .startswith ("test" ):
644
650
testfn = getattr (instance , k , v )
645
651
if patterns :
@@ -757,6 +763,8 @@ def run(self):
757
763
# some tests can modify the global scope leading to a RuntimeError: test_scope.test_nesting_plus_free_ref_to_global
758
764
module_dict = dict (module .__dict__ )
759
765
for k , v in module_dict .items ():
766
+ if exitting :
767
+ break
760
768
if (k .startswith ("Test" ) or k .endswith ("Test" ) or k .endswith ("Tests" )) and isinstance (v , type ):
761
769
testcases .append (TestCase .runClass (v ))
762
770
else :
0 commit comments