~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/__init__.py

  • Committer: Robert J. Tanner
  • Date: 2009-04-20 08:37:32 UTC
  • mfrom: (4299 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4300.
  • Revision ID: tanner@real-time.com-20090420083732-bzx919oo7wpmqc2u
[merge] 1.14rc2 back into bzr.dev (Bob Tanner)

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    tests,
33
33
    transform,
34
34
    )
35
 
from bzrlib.transport import get_transport
36
 
from bzrlib.tests import (
37
 
                          multiply_tests,
38
 
                          default_transport,
39
 
                          TestCaseWithTransport,
40
 
                          TestSkipped,
41
 
                          )
42
35
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
43
36
from bzrlib.tests.workingtree_implementations import (
44
37
    make_scenarios as wt_make_scenarios,
97
90
    return preview_tree
98
91
 
99
92
 
100
 
class TestTreeImplementationSupport(TestCaseWithTransport):
 
93
class TestTreeImplementationSupport(tests.TestCaseWithTransport):
101
94
 
102
95
    def test_revision_tree_from_workingtree(self):
103
96
        tree = self.make_branch_and_tree('.')
239
232
        note that the order of the paths and fileids is deliberately
240
233
        mismatched to ensure that the result order is path based.
241
234
        """
 
235
        self.requireFeature(tests.UnicodeFilenameFeature)
242
236
        tree = self.make_branch_and_tree('.')
243
237
        paths = ['0file',
244
238
            '1top-dir/',
253
247
            '1file-in-1topdir',
254
248
            '0dir-in-1topdir'
255
249
            ]
256
 
        try:
257
 
            self.build_tree(paths)
258
 
        except UnicodeError:
259
 
            raise TestSkipped(
260
 
                'This platform does not support unicode file paths.')
 
250
        self.build_tree(paths)
261
251
        tree.add(paths, ids)
262
252
        tt = transform.TreeTransform(tree)
263
253
        if symlinks:
274
264
 
275
265
    def _create_tree_with_utf8(self, tree):
276
266
        """Generate a tree with a utf8 revision and unicode paths."""
 
267
        self.requireFeature(tests.UnicodeFilenameFeature)
277
268
        # We avoid combining characters in file names here, normalization
278
269
        # checks (as performed by some file systems (OSX) are outside the scope
279
270
        # of these tests).  We use the euro sign \N{Euro Sign} or \u20ac in
290
281
                    'ba\xe2\x82\xacr-id',
291
282
                    'ba\xe2\x82\xacz-id',
292
283
                   ]
293
 
        try:
294
 
            self.build_tree(paths[1:])
295
 
        except UnicodeError:
296
 
            raise tests.TestSkipped('filesystem does not support unicode.')
 
284
        self.build_tree(paths[1:])
297
285
        if tree.get_root_id() is None:
298
286
            # Some trees do not have a root yet.
299
287
            tree.add(paths, file_ids)
333
321
    for scenario in scenarios:
334
322
        # for working tree format tests, preserve the tree
335
323
        scenario[1]["_workingtree_to_test_tree"] = return_parameter
336
 
        # add RevisionTree scenario
 
324
    # add RevisionTree scenario
337
325
    workingtree_format = WorkingTreeFormat._default_format
338
326
    scenarios.append((RevisionTree.__name__,
339
327
        create_tree_scenario(transport_server, transport_readonly_server,
359
347
    workingtree_format, converter):
360
348
    """Create a scenario for the specified converter
361
349
 
362
 
    :param name: The name to append to tests using this converter
363
350
    :param converter: A function that converts a workingtree into the
364
351
        desired format.
365
352
    :param workingtree_format: The particular workingtree format to
367
354
    :return: a (name, options) tuple, where options is a dict of values
368
355
        to be used as members of the TestCase.
369
356
    """
370
 
    scenario_options = wt_make_scenario(transport_server, transport_readonly_server,
371
 
        workingtree_format)
 
357
    scenario_options = wt_make_scenario(transport_server,
 
358
                                        transport_readonly_server,
 
359
                                        workingtree_format)
372
360
    scenario_options["_workingtree_to_test_tree"] = converter
373
361
    return scenario_options
374
362
 
389
377
        'bzrlib.tests.tree_implementations.test_walkdirs',
390
378
        ])
391
379
    scenarios = make_scenarios(
392
 
        default_transport,
 
380
        tests.default_transport,
393
381
        # None here will cause a readonly decorator to be created
394
382
        # by the TestCaseWithTransport.get_readonly_transport method.
395
383
        None,
396
384
        WorkingTreeFormat._formats.values() + _legacy_formats)
397
385
    # add the tests for the sub modules
398
 
    return multiply_tests(submod_tests, scenarios, standard_tests)
 
386
    return tests.multiply_tests(submod_tests, scenarios, standard_tests)