/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Martin Albisetti
  • Date: 2008-04-08 22:51:37 UTC
  • mfrom: (3346 +trunk)
  • mto: (3350.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 3351.
  • Revision ID: argentina@gmail.com-20080408225137-uynl9dxtsdpi8nl9
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
921
921
        test.run(result)
922
922
        self.assertEqual(
923
923
            [
924
 
            ('update', '[2 in 0s, 3 known failures] passing_test', None, None),
 
924
            ('update', '[2 in 0s] passing_test', None, None),
925
925
            ],
926
926
            pb.calls[2:])
927
927
 
997
997
        test.run(result)
998
998
        self.assertEqual(
999
999
            [
1000
 
            ('update', '[2 in 0s, 2 missing features] passing_test', None, None),
 
1000
            ('update', '[2 in 0s, 2 missing] passing_test', None, None),
1001
1001
            ],
1002
1002
            pb.calls[1:])
1003
1003
    
1964
1964
             'mod1.submod1',
1965
1965
             'mod1.submod2.cl1.meth1', 'mod1.submod2.cl2.meth2',
1966
1966
             ])
1967
 
        self.assertTrue(id_list.is_module_name_used('mod1'))
1968
 
        self.assertTrue(id_list.is_module_name_used('mod1.submod1'))
1969
 
        self.assertTrue(id_list.is_module_name_used('mod1.submod2'))
1970
 
        self.assertTrue(id_list.test_in('mod1.cl1.meth1'))
1971
 
        self.assertTrue(id_list.test_in('mod1.submod1'))
1972
 
        self.assertTrue(id_list.test_in('mod1.func1'))
 
1967
        self.assertTrue(id_list.refers_to('mod1'))
 
1968
        self.assertTrue(id_list.refers_to('mod1.submod1'))
 
1969
        self.assertTrue(id_list.refers_to('mod1.submod2'))
 
1970
        self.assertTrue(id_list.includes('mod1.cl1.meth1'))
 
1971
        self.assertTrue(id_list.includes('mod1.submod1'))
 
1972
        self.assertTrue(id_list.includes('mod1.func1'))
1973
1973
 
1974
1974
    def test_bad_chars_in_params(self):
1975
1975
        id_list = self._create_id_list(['mod1.cl1.meth1(xx.yy)'])
1976
 
        self.assertTrue(id_list.is_module_name_used('mod1'))
1977
 
        self.assertTrue(id_list.test_in('mod1.cl1.meth1(xx.yy)'))
 
1976
        self.assertTrue(id_list.refers_to('mod1'))
 
1977
        self.assertTrue(id_list.includes('mod1.cl1.meth1(xx.yy)'))
1978
1978
 
1979
1979
    def test_module_used(self):
1980
1980
        id_list = self._create_id_list(['mod.class.meth'])
1981
 
        self.assertTrue(id_list.is_module_name_used('mod'))
1982
 
        self.assertTrue(id_list.is_module_name_used('mod.class'))
1983
 
        self.assertTrue(id_list.is_module_name_used('mod.class.meth'))
 
1981
        self.assertTrue(id_list.refers_to('mod'))
 
1982
        self.assertTrue(id_list.refers_to('mod.class'))
 
1983
        self.assertTrue(id_list.refers_to('mod.class.meth'))
1984
1984
 
1985
1985
    def test_test_suite(self):
1986
1986
        # This test is slow, so we do a single test with one test in each
2059
2059
        self.assertEquals('bar baz', tlist[3])
2060
2060
 
2061
2061
 
 
2062
class TestFilteredByModuleTestLoader(tests.TestCase):
 
2063
 
 
2064
    def _create_loader(self, test_list):
 
2065
        id_filter = tests.TestIdList(test_list)
 
2066
        loader = TestUtil.FilteredByModuleTestLoader(id_filter.refers_to)
 
2067
        return loader
 
2068
 
 
2069
    def test_load_tests(self):
 
2070
        test_list = ['bzrlib.tests.test_sampler.DemoTest.test_nothing']
 
2071
        loader = self._create_loader(test_list)
 
2072
 
 
2073
        suite = loader.loadTestsFromModuleName('bzrlib.tests.test_sampler')
 
2074
        self.assertEquals(test_list, _test_ids(suite))
 
2075
 
 
2076
    def test_exclude_tests(self):
 
2077
        test_list = ['bogus']
 
2078
        loader = self._create_loader(test_list)
 
2079
 
 
2080
        suite = loader.loadTestsFromModuleName('bzrlib.tests.test_sampler')
 
2081
        self.assertEquals([], _test_ids(suite))