~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_smart_add.py

  • Committer: Vincent Ladeuil
  • Date: 2011-05-26 20:30:53 UTC
  • mfrom: (5920 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5924.
  • Revision ID: v.ladeuil+lp@free.fr-20110526203053-hbjn6yuzwg03wnuv
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
296
296
        self.wt = self.make_branch_and_tree('.')
297
297
        self.overrideAttr(osutils, 'normalized_filename')
298
298
 
 
299
    def test_requires_normalized_unicode_filenames_fails_on_unnormalized(self):
 
300
        """Adding unnormalized unicode filenames fail if and only if the
 
301
        workingtree format has the requires_normalized_unicode_filenames flag
 
302
        set.
 
303
        """
 
304
        osutils.normalized_filename = osutils._accessible_normalized_filename
 
305
        if self.workingtree_format.requires_normalized_unicode_filenames:
 
306
            self.assertRaises(
 
307
                errors.NoSuchFile, self.wt.smart_add, [u'a\u030a'])
 
308
        else:
 
309
            self.wt.smart_add([u'a\u030a'])
 
310
 
299
311
    def test_accessible_explicit(self):
300
312
        osutils.normalized_filename = osutils._accessible_normalized_filename
301
313
        if self.workingtree_format.requires_normalized_unicode_filenames:
302
 
            self.expectFailure(
303
 
                'Working tree format smart_add requires normalized unicode filenames',
304
 
                self.assertRaises, errors.NoSuchFile,
305
 
                self.wt.smart_add, [u'a\u030a'])
306
 
        else:
307
 
            self.wt.smart_add([u'a\u030a'])
 
314
            raise tests.TestNotApplicable(
 
315
                'Working tree format smart_add requires normalized unicode '
 
316
                'filenames')
 
317
        self.wt.smart_add([u'a\u030a'])
308
318
        self.wt.lock_read()
309
319
        self.addCleanup(self.wt.unlock)
310
320
        self.assertEqual([('', 'directory'), (u'\xe5', 'file')],
314
324
    def test_accessible_implicit(self):
315
325
        osutils.normalized_filename = osutils._accessible_normalized_filename
316
326
        if self.workingtree_format.requires_normalized_unicode_filenames:
317
 
            self.expectFailure(
318
 
                'Working tree format smart_add requires normalized unicode filenames',
319
 
                self.assertRaises, errors.NoSuchFile,
320
 
                self.wt.smart_add, [])
321
 
        else:
322
 
            self.wt.smart_add([])
 
327
            raise tests.TestNotApplicable(
 
328
                'Working tree format smart_add requires normalized unicode '
 
329
                'filenames')
 
330
        self.wt.smart_add([])
323
331
        self.wt.lock_read()
324
332
        self.addCleanup(self.wt.unlock)
325
333
        self.assertEqual([('', 'directory'), (u'\xe5', 'file')],