File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import print_function
22
3+ import os
4+
5+
36class TimeFilter (object ):
47 """This iterator saves to the specified output file only those tests
58 that complete successfully in max_time seconds or less. This output
@@ -29,13 +32,13 @@ def __init__(self, outfile):
2932 self .outfile = outfile
3033
3134 def get_iter (self , input_iter ):
32- fails = []
35+ try :
36+ os .remove (self .outfile )
37+ except OSError :
38+ pass
39+
3340 for result in input_iter :
3441 if result .status == 'FAIL' and not result .expected_fail :
35- fails .append (result .spec )
42+ with open (self .outfile , 'a' ) as f :
43+ print (result .spec , file = f )
3644 yield result
37-
38- if fails :
39- with open (self .outfile , 'w' ) as f :
40- for spec in sorted (fails ):
41- print (spec , file = f )
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ def testcontext(test):
5151 global _testing_path
5252 old_sys_path = sys .path
5353
54+ os .environ ['TESTFLO_SPEC' ] = test .spec
55+
5456 _testing_path [0 ] = test .test_dir
5557 sys .path = _testing_path
5658
@@ -61,6 +63,7 @@ def testcontext(test):
6163 test .err_msg = traceback .format_exc ()
6264 finally :
6365 sys .path = old_sys_path
66+ del os .environ ['TESTFLO_SPEC' ]
6467
6568
6669class Test (object ):
You can’t perform that action at this time.
0 commit comments