Rev 3649: Fix failing tests by avoiding unicode combinig encodings (we test in http://bazaar.launchpad.net/%7Ebzr/bzr/osx_tests_fix
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Sep 8 12:54:13 BST 2008
At http://bazaar.launchpad.net/%7Ebzr/bzr/osx_tests_fix
------------------------------------------------------------
revno: 3649
revision-id: v.ladeuil+lp at free.fr-20080908115340-9e8ef038ryotedx7
parent: v.ladeuil+lp at free.fr-20080908075607-yqbmjnhhmzdjz61y
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: osx_tests_fix
timestamp: Mon 2008-09-08 13:53:40 +0200
message:
Fix failing tests by avoiding unicode combinig encodings (we test
utf-8 not the file system encoding here).
* bzrlib/tests/tree_implementations/test_test_trees.py:
(TestTreeShapes.test_tree_with_merged_utf8): Use non-combining
unicode chars to avoid normalization ambiguities.
* bzrlib/tests/tree_implementations/__init__.py:
(TestCaseWithTree._create_tree_with_utf8): Use non-combining
unicode chars to avoid normalization ambiguities.
modified:
bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
bzrlib/tests/tree_implementations/test_test_trees.py test_tree_trees.py-20060720091921-3nwi5h21lf06vf5p-1
-------------- next part --------------
=== modified file 'bzrlib/tests/tree_implementations/__init__.py'
--- a/bzrlib/tests/tree_implementations/__init__.py 2008-08-28 23:43:12 +0000
+++ b/bzrlib/tests/tree_implementations/__init__.py 2008-09-08 11:53:40 +0000
@@ -272,17 +272,21 @@
def _create_tree_with_utf8(self, tree):
"""Generate a tree with a utf8 revision and unicode paths."""
+ # We avoid combining characters in file names here, normalization
+ # checks (as performed by some file systems (OSX) are outside the scope
+ # of these tests). We use the euro sign \N{Euro Sign} or \u20ac in
+ # unicode strings or '\xe2\x82\ac' (its utf-8 encoding) in raw strings.
paths = [u'',
- u'f\xf6',
- u'b\xe5r/',
- u'b\xe5r/b\xe1z',
+ u'fo\N{Euro Sign}o',
+ u'ba\N{Euro Sign}r/',
+ u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
]
# bzr itself does not create unicode file ids, but we want them for
# testing.
file_ids = ['TREE_ROOT',
- 'f\xc3\xb6-id',
- 'b\xc3\xa5r-id',
- 'b\xc3\xa1z-id',
+ 'fo\xe2\x82\xaco-id',
+ 'ba\xe2\x82\xacr-id',
+ 'ba\xe2\x82\xacz-id',
]
try:
self.build_tree(paths[1:])
@@ -304,8 +308,9 @@
"""Generate a tree with utf8 ancestors."""
self._create_tree_with_utf8(tree)
tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
- self.build_tree([u'tree2/b\xe5r/z\xf7z'])
- tree2.add([u'b\xe5r/z\xf7z'], [u'z\xf7z-id'.encode('utf-8')])
+ self.build_tree([u'tree2/ba\N{Euro Sign}r/qu\N{Euro Sign}x'])
+ tree2.add([u'ba\N{Euro Sign}r/qu\N{Euro Sign}x'],
+ [u'qu\N{Euro Sign}x-id'.encode('utf-8')])
tree2.commit(u'to m\xe9rge', rev_id=u'r\xe9v-2'.encode('utf8'))
tree.merge_from_branch(tree2.branch)
=== modified file 'bzrlib/tests/tree_implementations/test_test_trees.py'
--- a/bzrlib/tests/tree_implementations/test_test_trees.py 2008-04-12 19:43:13 +0000
+++ b/bzrlib/tests/tree_implementations/test_test_trees.py 2008-09-08 11:53:40 +0000
@@ -260,15 +260,17 @@
revision_id_1 = u'r\xe9v-1'.encode('utf8')
revision_id_2 = u'r\xe9v-2'.encode('utf8')
root_id = 'TREE_ROOT'
- bar_id = u'b\xe5r-id'.encode('utf8')
- foo_id = u'f\xf6-id'.encode('utf8')
- baz_id = u'b\xe1z-id'.encode('utf8')
- zez_id = u'z\xf7z-id'.encode('utf8')
+ bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
+ foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
+ baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
+ qux_id = u'qu\N{Euro Sign}x-id'.encode('utf8')
path_and_ids = [(u'', root_id, None, None),
- (u'b\xe5r', bar_id, root_id, revision_id_1),
- (u'f\xf6', foo_id, root_id, revision_id_1),
- (u'b\xe5r/b\xe1z', baz_id, bar_id, revision_id_1),
- (u'b\xe5r/z\xf7z', zez_id, bar_id, revision_id_2),
+ (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id_1),
+ (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id_1),
+ (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
+ baz_id, bar_id, revision_id_1),
+ (u'ba\N{Euro Sign}r/qu\N{Euro Sign}x',
+ qux_id, bar_id, revision_id_2),
]
tree.lock_read()
try:
@@ -276,22 +278,23 @@
finally:
tree.unlock()
- for expected, (path, ie) in zip(path_and_ids, path_entries):
- self.assertEqual(expected[0], path) # Paths should match
+ for (epath, efid, eparent, erev), (path, ie) in zip(path_and_ids,
+ path_entries):
+ self.assertEqual(epath, path) # Paths should match
self.assertIsInstance(path, unicode)
- self.assertEqual(expected[1], ie.file_id)
+ self.assertEqual(efid, ie.file_id)
self.assertIsInstance(ie.file_id, str)
- self.assertEqual(expected[2], ie.parent_id)
- if expected[2] is not None:
+ self.assertEqual(eparent, ie.parent_id)
+ if eparent is not None:
self.assertIsInstance(ie.parent_id, str)
# WorkingTree's return None for the last modified revision
if ie.revision is not None:
self.assertIsInstance(ie.revision, str)
- if expected[0] == '':
+ if epath == '':
# Some trees will preserve the revision id of the tree root,
# but not all will
continue
- self.assertEqual(expected[3], ie.revision)
+ self.assertEqual(erev, ie.revision)
self.assertEqual(len(path_and_ids), len(path_entries))
get_revision_id = getattr(tree, 'get_revision_id', None)
if get_revision_id is not None:
More information about the bazaar-commits
mailing list