/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: Ian Clatworthy
  • Date: 2009-07-13 06:04:28 UTC
  • mfrom: (4527 +trunk)
  • mto: (4527.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4529.
  • Revision ID: ian.clatworthy@canonical.com-20090713060428-5m6apiywie6aqg6v
merge bzr.dev r4527

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
            def get_test_permutations(self):
121
121
                return sample_permutation
122
122
        sample_permutation = [(1,2), (3,4)]
123
 
        from bzrlib.tests.test_transport_implementations \
124
 
            import get_transport_test_permutations
 
123
        from bzrlib.tests.per_transport import get_transport_test_permutations
125
124
        self.assertEqual(sample_permutation,
126
125
                         get_transport_test_permutations(MockModule()))
127
126
 
130
129
        # as there are in all the registered transport modules - we assume if
131
130
        # this matches its probably doing the right thing especially in
132
131
        # combination with the tests for setting the right classes below.
133
 
        from bzrlib.tests.test_transport_implementations \
134
 
            import transport_test_permutations
 
132
        from bzrlib.tests.per_transport import transport_test_permutations
135
133
        from bzrlib.transport import _get_transport_modules
136
134
        modules = _get_transport_modules()
137
135
        permutation_count = 0
149
147
        # This test used to know about all the possible transports and the
150
148
        # order they were returned but that seems overly brittle (mbp
151
149
        # 20060307)
152
 
        from bzrlib.tests.test_transport_implementations \
153
 
            import transport_test_permutations
 
150
        from bzrlib.tests.per_transport import transport_test_permutations
154
151
        scenarios = transport_test_permutations()
155
152
        # there are at least that many builtin transports
156
153
        self.assertTrue(len(scenarios) > 6)
167
164
    def test_scenarios(self):
168
165
        # check that constructor parameters are passed through to the adapted
169
166
        # test.
170
 
        from bzrlib.tests.branch_implementations import make_scenarios
 
167
        from bzrlib.tests.per_branch import make_scenarios
171
168
        server1 = "a"
172
169
        server2 = "b"
173
170
        formats = [("c", "C"), ("d", "D")]
192
189
    def test_scenarios(self):
193
190
        # check that constructor parameters are passed through to the adapted
194
191
        # test.
195
 
        from bzrlib.tests.bzrdir_implementations import make_scenarios
 
192
        from bzrlib.tests.per_bzrdir import make_scenarios
196
193
        vfs_factory = "v"
197
194
        server1 = "a"
198
195
        server2 = "b"
293
290
    def test_scenarios(self):
294
291
        # check that constructor parameters are passed through to the adapted
295
292
        # test.
296
 
        from bzrlib.tests.interrepository_implementations import \
297
 
            make_scenarios
 
293
        from bzrlib.tests.per_interrepository import make_scenarios
298
294
        server1 = "a"
299
295
        server2 = "b"
300
296
        formats = [(str, "C1", "C2"), (int, "D1", "D2")]
320
316
    def test_scenarios(self):
321
317
        # check that constructor parameters are passed through to the adapted
322
318
        # test.
323
 
        from bzrlib.tests.workingtree_implementations \
324
 
            import make_scenarios
 
319
        from bzrlib.tests.per_workingtree import make_scenarios
325
320
        server1 = "a"
326
321
        server2 = "b"
327
322
        formats = [workingtree.WorkingTreeFormat2(),
351
346
        # workingtree_to_test_tree attribute set to 'return_parameter' and the
352
347
        # revision one set to revision_tree_from_workingtree.
353
348
 
354
 
        from bzrlib.tests.tree_implementations import (
 
349
        from bzrlib.tests.per_tree import (
355
350
            _dirstate_tree_from_workingtree,
356
351
            make_scenarios,
357
352
            preview_tree_pre,
433
428
        # unlike the TestProviderAdapter we dont want to automatically add a
434
429
        # parameterized one for WorkingTree - the optimisers will tell us what
435
430
        # ones to add.
436
 
        from bzrlib.tests.tree_implementations import (
 
431
        from bzrlib.tests.per_tree import (
437
432
            return_parameter,
438
433
            revision_tree_from_workingtree
439
434
            )
440
 
        from bzrlib.tests.intertree_implementations import (
 
435
        from bzrlib.tests.per_intertree import (
441
436
            make_scenarios,
442
437
            )
443
438
        from bzrlib.workingtree import WorkingTreeFormat2, WorkingTreeFormat3
2170
2165
        self.assertTrue(id_list.refers_to('mod.class'))
2171
2166
        self.assertTrue(id_list.refers_to('mod.class.meth'))
2172
2167
 
2173
 
    def test_test_suite(self):
2174
 
        # This test is slow, so we do a single test with one test in each
2175
 
        # category
2176
 
        test_list = [
2177
 
            # testmod_names
2178
 
            'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch',
2179
 
            'bzrlib.tests.test_selftest.TestTestIdList.test_test_suite',
2180
 
            # transport implementations
2181
 
            'bzrlib.tests.test_transport_implementations.TransportTests'
2182
 
            '.test_abspath(LocalURLServer)',
2183
 
            # modules_to_doctest
2184
 
            'bzrlib.timestamp.format_highres_date',
2185
 
            # plugins can't be tested that way since selftest may be run with
2186
 
            # --no-plugins
2187
 
            ]
2188
 
        suite = tests.test_suite(test_list)
2189
 
        self.assertEquals(test_list, _test_ids(suite))
2190
 
 
2191
2168
    def test_test_suite_matches_id_list_with_unknown(self):
2192
2169
        loader = TestUtil.TestLoader()
2193
2170
        suite = loader.loadTestsFromModuleName('bzrlib.tests.test_sampler')
2213
2190
                          duplicates)
2214
2191
 
2215
2192
 
 
2193
class TestTestSuite(tests.TestCase):
 
2194
 
 
2195
    def test_test_suite(self):
 
2196
        # This test is slow, so we do a single test with one test in each
 
2197
        # category
 
2198
        test_list = [
 
2199
            # testmod_names
 
2200
            'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch',
 
2201
            ('bzrlib.tests.per_transport.TransportTests'
 
2202
             '.test_abspath(LocalURLServer)'),
 
2203
            'bzrlib.tests.test_selftest.TestTestSuite.test_test_suite',
 
2204
            # modules_to_doctest
 
2205
            'bzrlib.timestamp.format_highres_date',
 
2206
            # plugins can't be tested that way since selftest may be run with
 
2207
            # --no-plugins
 
2208
            ]
 
2209
        suite = tests.test_suite(test_list)
 
2210
        self.assertEquals(test_list, _test_ids(suite))
 
2211
 
 
2212
    def test_test_suite_list_and_start(self):
 
2213
        test_list = ['bzrlib.tests.test_selftest.TestTestSuite.test_test_suite']
 
2214
        suite = tests.test_suite(test_list,
 
2215
                                 ['bzrlib.tests.test_selftest.TestTestSuite'])
 
2216
        # test_test_suite_list_and_start is not included 
 
2217
        self.assertEquals(test_list, _test_ids(suite))
 
2218
 
 
2219
 
2216
2220
class TestLoadTestIdList(tests.TestCaseInTempDir):
2217
2221
 
2218
2222
    def _create_test_list_file(self, file_name, content):