Exemple #1
0
 def test_no_matching_tests_with_one_selector_each(self):
     configurer = SuiteConfigurer(include_tags='i',
                                  exclude_tags='e',
                                  include_suites='s',
                                  include_tests='t')
     assert_raises_with_msg(
         DataError, "Suite 'root' contains no tests with tag 'i', "
         "without tag 'e' and named 't' in suite 's'.",
         configurer.configure, self.suite)
 def test_no_matching_tests_with_one_selector_each(self):
     configurer = SuiteConfigurer(include_tags='i',
                                  exclude_tags='e',
                                  include_suites='s',
                                  include_tests='t')
     assert_raises_with_msg(
         DataError, "Suite 'root' contains no tests matching tag 'i', "
         "not matching tag 'e' and matching name 't' in suite 's'.",
         self.suite.visit, configurer)
Exemple #3
0
 def test_no_matching_tests_with_multiple_selectors(self):
     configurer = SuiteConfigurer(include_tags=['i1', 'i2'],
                                  exclude_tags=['e1', 'e2'],
                                  include_suites=['s1', 's2', 's3'],
                                  include_tests=['t1', 't2'])
     assert_raises_with_msg(
         DataError,
         "Suite 'root' contains no tests with tags 'i1' or 'i2', "
         "without tags 'e1' or 'e2' and named 't1' or 't2' "
         "in suites 's1', 's2' or 's3'.", configurer.configure, self.suite)
Exemple #4
0
 def test_metadata(self):
     self.suite.visit(SuiteConfigurer(metadata={'bb': '2', 'C': '2'}))
     assert_equal(self.suite.metadata, {'A A': '1', 'bb': '2', 'C': '2'})
Exemple #5
0
 def test_set_tags(self):
     SuiteConfigurer(set_tags=['new']).configure(self.suite)
     assert_equal(list(self.suite.tests[0].tags), ['new'])
     assert_equal(list(self.suite.suites[0].tests[0].tags), ['new', 'tag'])
Exemple #6
0
 def test_exclude(self):
     SuiteConfigurer(exclude_tags=['t1', '?1ANDt2']).configure(self.suite)
     assert_equal([t.name for t in self.suite.tests], ['n0'])
     assert_equal(list(self.suite.suites), [])
Exemple #7
0
 def test_include_by_names(self):
     SuiteConfigurer(include_suites=['s?b', 'xxx'],
                     include_tests=['', '*1', 'xxx']).configure(self.suite)
     assert_equal(list(self.suite.tests), [])
     assert_equal([t.name for t in self.suite.suites[0].tests], ['n1'])
Exemple #8
0
 def test_remove_negative_tags_using_pattern(self):
     SuiteConfigurer(set_tags=['-t*', '-nomatch']).configure(self.suite)
     assert_equal(list(self.suite.tests[0].tags), [])
     assert_equal(list(self.suite.suites[0].tests[0].tags), [])
Exemple #9
0
 def test_include(self):
     SuiteConfigurer(include_tags=['t1', 'none', '', '?2']).configure(
         self.suite)
     assert_equal([t.name for t in self.suite.tests], ['n1', 'n2'])
     assert_equal([t.name for t in self.suite.suites[0].tests], ['n1'])
Exemple #10
0
 def test_tags_are_normalized(self):
     SuiteConfigurer(set_tags=['TAG', '', 't a g', 'NONE']).configure(
         self.suite)
     assert_equal(list(self.suite.tests[0].tags), ['TAG'])
     assert_equal(list(self.suite.suites[0].tests[0].tags), ['tag'])
Exemple #11
0
 def test_remove_negative_tags(self):
     SuiteConfigurer(set_tags=['n', '-TAG']).configure(self.suite)
     assert_equal(list(self.suite.tests[0].tags), ['n'])
     assert_equal(list(self.suite.suites[0].tests[0].tags), ['n'])
Exemple #12
0
 def _remove(self, option, item):
     SuiteConfigurer(remove_keywords=option).configure(item)
Exemple #13
0
 def test_empty_suite(self):
     suite = TestSuite(name='x')
     suite.visit(SuiteConfigurer(empty_suite_ok=True))
     assert_raises_with_msg(DataError, "Suite 'x' contains no tests.",
                            suite.visit, SuiteConfigurer())
Exemple #14
0
 def test_metadata_is_normalized(self):
     SuiteConfigurer(metadata={'aa': '2', 'B_B': '2'}).configure(self.suite)
     assert_equal(self.suite.metadata, {'A A': '2', 'bb': '2'})
Exemple #15
0
 def test_metadata(self):
     SuiteConfigurer(metadata={'bb': '2', 'C': '2'}).configure(self.suite)
     assert_equal(self.suite.metadata, {'A A': '1', 'bb': '2', 'C': '2'})
Exemple #16
0
 def test_name_and_doc(self):
     SuiteConfigurer(name='New Name', doc='New Doc').configure(self.suite)
     assert_equal(self.suite.name, 'New Name')
     assert_equal(self.suite.doc, 'New Doc')
Exemple #17
0
 def test_empty_suite(self):
     assert_raises_with_msg(DataError, "Suite 'x' contains no tests.",
                            SuiteConfigurer().configure,
                            TestSuite(name='x'))
Exemple #18
0
 def _remove(self, option, item):
     item.visit(SuiteConfigurer(remove_keywords=option))