File tree Expand file tree Collapse file tree 1 file changed +7
-30
lines changed Expand file tree Collapse file tree 1 file changed +7
-30
lines changed Original file line number Diff line number Diff line change @@ -237,36 +237,13 @@ _all_test_info = {} # type: Dict[str, TestInfo]
237237def get_all_test_info ():
238238 """ Open and collate each info.json """
239239
240- # Short circuit if already cached
241- if _all_test_info :
242- return _all_test_info
243-
244- for test in os .listdir ("tests" ):
245-
246- info_file = None
247- try :
248-
249- # Ignore directories which don't have a info.json inside them
250- try :
251- info_file = open (path .join ("tests" , test , "info.json" ))
252- except IOError :
253- continue
254-
255- # Ignore tests which have bad JSON
256- try :
257- test_info = TestInfo (json .load (info_file ))
258-
259- if test_info .name != test :
260- continue
261-
262- except (ValueError , KeyError , TypeError ):
263- continue
264-
265- _all_test_info [test ] = test_info
266-
267- finally :
268- if info_file :
269- info_file .close ()
240+ if not _all_test_info :
241+ for test in os .listdir ("tests" ):
242+ info_file = path .join ("tests" , test , "info.json" )
243+ if not os .path .exists (info_file ):
244+ continue # Not a test dir or test was not built successfully
245+ with open (info_file ) as info :
246+ _all_test_info [test ] = TestInfo (json .loads (info .read ()))
270247
271248 return _all_test_info
272249
You can’t perform that action at this time.
0 commit comments