At file:///home/pqm/archives/thelove/bzr/%2Btrunk/ ------------------------------------------------------------ revno: 5016 [merge] revision-id: [email protected] parent: [email protected] parent: [email protected] committer: Canonical.com Patch Queue Manager <[email protected]> branch nick: +trunk timestamp: Mon 2010-02-08 12:06:24 +0000 message: (vila)(trivial) Simplify some tests in per_workingtree/test_smart_add.py modified: bzrlib/tests/per_workingtree/test_smart_add.py test_smart_add.py-20070215175752-9s5mxoz8aqpd80fm-1 === modified file 'bzrlib/tests/per_workingtree/test_smart_add.py' --- a/bzrlib/tests/per_workingtree/test_smart_add.py 2010-02-08 10:00:04 +0000 +++ b/bzrlib/tests/per_workingtree/test_smart_add.py 2010-02-08 10:49:48 +0000 @@ -28,6 +28,7 @@ workingtree, ) from bzrlib.tests import ( + features, test_smart_add, per_workingtree, ) @@ -225,60 +226,43 @@ ], [(path, ie.file_id) for path, ie in wt.inventory.iter_entries()]) - def make_unicode_containing_tree(self): - try: - self.build_tree([u'a\u030a']) - except UnicodeError: - raise tests.TestSkipped('Filesystem cannot create unicode filenames') + +class TestSmartAddTreeUnicode(per_workingtree.TestCaseWithWorkingTree): + + _test_needs_features = [tests.UnicodeFilenameFeature] + + def setUp(self): + super(TestSmartAddTreeUnicode, self).setUp() + self.build_tree([u'a\u030a']) self.wt = self.make_branch_and_tree('.') + self.overrideAttr(osutils, 'normalized_filename') def test_accessible_explicit(self): - self.make_unicode_containing_tree() - orig = osutils.normalized_filename osutils.normalized_filename = osutils._accessible_normalized_filename - try: - self.wt.smart_add([u'a\u030a']) - self.wt.lock_read() - self.addCleanup(self.wt.unlock) - self.assertEqual([('', 'directory'), (u'\xe5', 'file')], - [(path, ie.kind) for path,ie in - self.wt.inventory.iter_entries()]) - finally: - osutils.normalized_filename = orig + self.wt.smart_add([u'a\u030a']) + self.wt.lock_read() + self.addCleanup(self.wt.unlock) + self.assertEqual([('', 'directory'), (u'\xe5', 'file')], + [(path, ie.kind) for path,ie in + self.wt.inventory.iter_entries()]) def test_accessible_implicit(self): - self.make_unicode_containing_tree() - orig = osutils.normalized_filename osutils.normalized_filename = osutils._accessible_normalized_filename - try: - self.wt.smart_add([]) - self.wt.lock_read() - self.addCleanup(self.wt.unlock) - self.assertEqual([('', 'directory'), (u'\xe5', 'file')], - [(path, ie.kind) for path,ie in - self.wt.inventory.iter_entries()]) - finally: - osutils.normalized_filename = orig + self.wt.smart_add([]) + self.wt.lock_read() + self.addCleanup(self.wt.unlock) + self.assertEqual([('', 'directory'), (u'\xe5', 'file')], + [(path, ie.kind) for path,ie in + self.wt.inventory.iter_entries()]) def test_inaccessible_explicit(self): - self.make_unicode_containing_tree() - orig = osutils.normalized_filename osutils.normalized_filename = osutils._inaccessible_normalized_filename - try: - self.assertRaises(errors.InvalidNormalization, - self.wt.smart_add, [u'a\u030a']) - finally: - osutils.normalized_filename = orig + self.assertRaises(errors.InvalidNormalization, + self.wt.smart_add, [u'a\u030a']) def test_inaccessible_implicit(self): - self.make_unicode_containing_tree() - orig = osutils.normalized_filename osutils.normalized_filename = osutils._inaccessible_normalized_filename - try: - # TODO: jam 20060701 In the future, this should probably - # just ignore files that don't fit the normalization - # rules, rather than exploding - self.assertRaises(errors.InvalidNormalization, - self.wt.smart_add, []) - finally: - osutils.normalized_filename = orig + # TODO: jam 20060701 In the future, this should probably + # just ignore files that don't fit the normalization + # rules, rather than exploding + self.assertRaises(errors.InvalidNormalization, self.wt.smart_add, [])
-- bazaar-commits mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/bazaar-commits
