66import glob
77import re
88from ..resources import *
9+ from ..tabquery_path import TabQueryPath
910
1011class TestFile (object ):
1112 """
@@ -26,7 +27,8 @@ class TestSet(object):
2627 Represents everything needed to run a set of tests. This includes a path to the test files, which tds etc.
2728 """
2829 def __init__ (self , ds_name , root_dir , config_name , tds_name , exclusions , test_pattern , is_logical , suite_name , password_file ,
29- expected_message , smoke_test = False , test_is_enabled = True , test_is_skipped = False ):
30+ expected_message : str = '' , smoke_test : bool = False , test_is_enabled : bool = True ,
31+ test_is_skipped : bool = False ):
3032 self .ds_name = ds_name
3133 self .suite_name = suite_name
3234 self .config_name = config_name
@@ -40,6 +42,8 @@ def __init__(self, ds_name, root_dir, config_name, tds_name, exclusions, test_pa
4042 self .smoke_test = smoke_test
4143 self .test_is_enabled = test_is_enabled
4244 self .test_is_skipped = test_is_skipped
45+ self .test_list_cached = None
46+ self .test_list_checked = False
4347
4448
4549 def is_logical_test (self ):
@@ -62,24 +66,20 @@ def generate_test_file_list(self):
6266 Return the sorted list of tests.
6367
6468 """
65- final_test_list = self .generate_test_file_list_from_config ()
69+ if self .test_list_checked :
70+ return self .test_list_cached
6671
67- logging .debug ("Found final list of " + str (len (final_test_list )) + " tests to run." )
68- if len (final_test_list ) == 0 :
69- logging .warning ("Did not find any tests to run." )
70- print ("Did not find any tests to run." )
71- return final_test_list
72+ final_test_list = self .__generate_test_file_list ()
7273
73- for x in final_test_list :
74- logging .debug ("final test path " + x .test_path )
75-
76- return final_test_list
74+ self .test_list_cached = final_test_list
75+ self .test_list_checked = True
76+ return self .test_list_cached
7777
7878 def get_test_dirs (self ):
7979 return (self .root_dir , get_local_test_dir ())
8080
81- def generate_test_file_list_from_config (self ):
82- """Read the config file and generate a list of tests."""
81+ def __generate_test_file_list (self ):
82+ """Private function to generate the list of tests."""
8383 allowed_tests = []
8484 exclude_tests = self .get_exclusions ()
8585 exclude_tests .append ('expected.' )
@@ -181,7 +181,7 @@ def get_actual_and_base_file_path(self, test_file, output_dir):
181181 def append_test_file (self , file_path ):
182182 self .test_paths .append (file_path )
183183
184- def generate_test_file_list_from_config (self ):
184+ def generate_test_file_list (self ):
185185 tests_to_run = []
186186 for test_file in self .test_paths :
187187 added_test = False
@@ -249,30 +249,6 @@ def build_config_name(prefix, dsname):
249249def build_tds_name (prefix , dsname ):
250250 return prefix + dsname + '.tds'
251251
252- class TabQueryPath (object ):
253- def __init__ (self , linux_path , mac_path , windows_path ):
254- self .linux_path = linux_path
255- self .mac_path = mac_path
256- self .windows_path = windows_path
257-
258- @staticmethod
259- def from_array (paths ):
260- if len (paths ) != 3 :
261- raise IndexError
262- t = TabQueryPath (paths [0 ], paths [1 ], paths [2 ])
263- return t
264-
265- def to_array (self ):
266- return [self .linux_path , self .mac_path , self .windows_path ]
267-
268- def get_path (self , os ):
269- if os .startswith ("darwin" ):
270- return self .mac_path
271- elif os .startswith ("linux" ):
272- return self .linux_path
273- else :
274- return self .windows_path
275-
276252class RunTimeTestConfig (object ):
277253 """
278254 Tracks specifics about how a group of tests were run.
0 commit comments