def execute(self, select_metadata=None, select_tests=None, parallel_manager=None): if select_metadata: self.cases = find_by_metadata(select_metadata, self.cases) self.describes = children_with_tests_with_metadata( select_metadata, self) if select_tests: self.cases = find_by_names(select_tests, self.cases) self.describes = children_with_tests_named(select_tests, self) # If it doesn't have tests or describes don't run it if len(self.cases) <= 0 and len(self.describes) <= 0: return # Sort suite case funcs to ensure stable order of execution self.cases = self._sort_cases(self.cases) if parallel_manager: self.parallel_execution( parallel_manager, select_metadata, select_tests ) else: self.standard_execution(select_metadata, select_tests)
def execute(self, select_metadata=None): if select_metadata: self.cases = find_by_metadata(select_metadata, self.cases) self.describes = children_with_tests_with_metadata( select_metadata, self) # If it doesn't have tests or describes don't run it if len(self.cases) <= 0 and len(self.describes) <= 0: return self.top_parent.dispatch(DescribeEvent(DescribeEvent.START, self)) self.before_all() # Execute Cases for case in self.cases: self.before_each() case.execute(context=self) self.after_each() self.top_parent.dispatch(TestEvent(case)) # Execute Suites for describe in self.describes: describe.execute(select_metadata=select_metadata) self.after_all() self.top_parent.dispatch(DescribeEvent(DescribeEvent.COMPLETE, self))
def test_find_by_metadata(self): wrap1 = spec.CaseWrapper(None, None, metadata={'test': 'smoke'}) wrap2 = spec.CaseWrapper(None, None, metadata={'test': 'bam'}) test_list = {wrap1.id: wrap1, wrap2.id: wrap2} found = util.find_by_metadata({'test': 'smoke'}, test_list) self.assertEqual(len(found), 1) self.assertIn(wrap1.id, found)
def execute(self, select_metadata=None, parallel_manager=None): if select_metadata: self.cases = find_by_metadata(select_metadata, self.cases) self.describes = children_with_tests_with_metadata( select_metadata, self) # If it doesn't have tests or describes don't run it if len(self.cases) <= 0 and len(self.describes) <= 0: return if parallel_manager: self.parallel_execution(parallel_manager, select_metadata) else: self.standard_execution(select_metadata)