/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/tree_implementations/__init__.py

  • Committer: Martin Pool
  • Date: 2009-06-10 02:51:23 UTC
  • mfrom: (4423 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4464.
  • Revision ID: mbp@sourcefrog.net-20090610025123-2u0c0ng5jcezjzqh
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
"""Tree implementation tests for bzr.
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
 
377
365
    submod_tests = loader.loadTestsFromModuleNames([
378
366
        'bzrlib.tests.tree_implementations.test_annotate_iter',
379
367
        'bzrlib.tests.tree_implementations.test_get_file_mtime',
 
368
        'bzrlib.tests.tree_implementations.test_get_file_with_stat',
380
369
        'bzrlib.tests.tree_implementations.test_get_root_id',
381
370
        'bzrlib.tests.tree_implementations.test_get_symlink_target',
382
371
        'bzrlib.tests.tree_implementations.test_inv',
389
378
        'bzrlib.tests.tree_implementations.test_walkdirs',
390
379
        ])
391
380
    scenarios = make_scenarios(
392
 
        default_transport,
 
381
        tests.default_transport,
393
382
        # None here will cause a readonly decorator to be created
394
383
        # by the TestCaseWithTransport.get_readonly_transport method.
395
384
        None,
396
385
        WorkingTreeFormat._formats.values() + _legacy_formats)
397
386
    # add the tests for the sub modules
398
 
    return multiply_tests(submod_tests, scenarios, standard_tests)
 
387
    return tests.multiply_tests(submod_tests, scenarios, standard_tests)