def run(self): if self.logfiles: for logfile in self.logfiles: TINCMMProgram._handle_logfile(logfile, tincmm_log_config) return if self.discover_options: # construct an argument list out of discover_options argv = shlex.split(self.discover_options) self.test_suite = TINCTestProgram.construct_discover_test_suite( argv)[0] # Construct mm objects for the test suite # Construct a query handler query_handler = TINCMMQueryHandler(self.queries) test_suite_mm = TINCTestSuiteMM(self.test_suite) test_suite_mm.apply_queries(query_handler)
def _apply_mm_queries(logparser, test_buckets, tincmm_log_config): """ test_buckets contains individual bucket of test tuples based on the above distribution algorithm. Construct a test suite for each of the bucket and apply mm queries from tincmm_log_config """ for bucket, idx in zip(test_buckets, range(len(test_buckets))): suite = TINCTestSuite() for test_tuple in bucket: test_case = logparser.dict_of_test_tuples[ test_tuple.name].test_case_object # LIMITATION: We always set _all_tests_loaded to False for tincmm log parser. # It is difficult to find out at this point whether all tests from a test class # belongs to the same bucket. Most common use cases will split a test class # into multiple buckets and hence we assume that tincmm can operate on the # method docstrings test_case.__class__._all_tests_loaded = False suite.addTest(test_case) query_handler = TINCMMQueryHandler( tincmm_log_config.bucket_queries[idx]) tinc_test_suite_mm = TINCTestSuiteMM(suite) tinc_test_suite_mm.apply_queries(query_handler)