~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Vincent Ladeuil
  • Date: 2008-09-08 15:31:26 UTC
  • mto: (3703.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 3704.
  • Revision ID: v.ladeuil+lp@free.fr-20080908153126-rhjjxxng1czkh4vb
Remove XFAIL from test_unicode_bundle.

* bzrlib/tests/test_bundle.py:
(BundleTester.test_unicode_bundle): Don't use unicode ambiguous
file names, that's the point of the test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
from bzrlib.bundle.serializer.v4 import BundleSerializerV4
39
39
from bzrlib.branch import Branch
40
40
from bzrlib.diff import internal_diff
41
 
from bzrlib.errors import (BzrError, TestamentMismatch, NotABundle, BadBundle, 
42
 
                           NoSuchFile,)
43
41
from bzrlib.merge import Merge3Merger
44
42
from bzrlib.repofmt import knitrepo
45
43
from bzrlib.osutils import sha_file, sha_string
106
104
        elif kind == 'symlink':
107
105
            ie = InventoryLink(file_id, name, parent_id)
108
106
        else:
109
 
            raise BzrError('unknown kind %r' % kind)
 
107
            raise errors.BzrError('unknown kind %r' % kind)
110
108
        ie.text_sha1 = text_sha_1
111
109
        ie.text_size = text_size
112
110
        return ie
435
433
        return bundle 
436
434
 
437
435
    def test_non_bundle(self):
438
 
        self.assertRaises(NotABundle, read_bundle, StringIO('#!/bin/sh\n'))
 
436
        self.assertRaises(errors.NotABundle,
 
437
                          read_bundle, StringIO('#!/bin/sh\n'))
439
438
 
440
439
    def test_malformed(self):
441
 
        self.assertRaises(BadBundle, read_bundle, 
 
440
        self.assertRaises(errors.BadBundle, read_bundle,
442
441
                          StringIO('# Bazaar revision bundle v'))
443
442
 
444
443
    def test_crlf_bundle(self):
445
444
        try:
446
445
            read_bundle(StringIO('# Bazaar revision bundle v0.8\r\n'))
447
 
        except BadBundle:
 
446
        except errors.BadBundle:
448
447
            # It is currently permitted for bundles with crlf line endings to
449
448
            # make read_bundle raise a BadBundle, but this should be fixed.
450
449
            # Anything else, especially NotABundle, is an error.
482
481
                for inventory_id in old:
483
482
                    try:
484
483
                        old_file = old.get_file(inventory_id)
485
 
                    except NoSuchFile:
 
484
                    except errors.NoSuchFile:
486
485
                        continue
487
486
                    if old_file is None:
488
487
                        continue
618
617
        self.tree1.commit('removed', rev_id='a@cset-0-3')
619
618
        
620
619
        bundle = self.get_valid_bundle('a@cset-0-2', 'a@cset-0-3')
621
 
        self.assertRaises((TestamentMismatch,
 
620
        self.assertRaises((errors.TestamentMismatch,
622
621
            errors.VersionedFileInvalidChecksum), self.get_invalid_bundle,
623
622
            'a@cset-0-2', 'a@cset-0-3')
624
623
        # Check a rollup bundle 
796
795
        # Handle international characters
797
796
        os.mkdir('b1')
798
797
        try:
799
 
            f = open(u'b1/with Dod\xe9', 'wb')
 
798
            f = open(u'b1/foo', 'wb')
800
799
        except UnicodeEncodeError:
801
800
            raise TestSkipped("Filesystem doesn't support unicode")
802
801
 
808
807
            u'William Dod\xe9\n').encode('utf-8'))
809
808
        f.close()
810
809
 
811
 
        self.tree1.add([u'with Dod\xe9'], ['withdod-id'])
 
810
        self.tree1.add([u'foo'], ['withdod-id'])
812
811
        self.tree1.commit(u'i18n commit from William Dod\xe9',
813
812
                          rev_id='i18n-1', committer=u'William Dod\xe9')
814
813
 
815
 
        if sys.platform == 'darwin':
816
 
            from bzrlib.workingtree import WorkingTree3
817
 
            if type(self.tree1) is WorkingTree3:
818
 
                self.knownFailure("Bug #141438: fails for WorkingTree3 on OSX")
819
 
 
820
 
            # On Mac the '\xe9' gets changed to 'e\u0301'
821
 
            self.assertEqual([u'.bzr', u'with Dode\u0301'],
822
 
                             sorted(os.listdir(u'b1')))
823
 
            delta = self.tree1.changes_from(self.tree1.basis_tree())
824
 
            self.assertEqual([(u'with Dod\xe9', 'withdod-id', 'file')],
825
 
                             delta.removed)
826
 
            self.knownFailure("Mac OSX doesn't preserve unicode"
827
 
                              " combining characters.")
828
 
 
829
814
        # Add
830
815
        bundle = self.get_valid_bundle('null:', 'i18n-1')
831
816
 
832
817
        # Modified
833
 
        f = open(u'b1/with Dod\xe9', 'wb')
 
818
        f = open(u'b1/foo', 'wb')
834
819
        f.write(u'Modified \xb5\n'.encode('utf8'))
835
820
        f.close()
836
821
        self.tree1.commit(u'modified', rev_id='i18n-2')
837
822
 
838
823
        bundle = self.get_valid_bundle('i18n-1', 'i18n-2')
839
 
        
 
824
 
840
825
        # Renamed
841
 
        self.tree1.rename_one(u'with Dod\xe9', u'B\xe5gfors')
 
826
        self.tree1.rename_one(u'foo', u'bar')
842
827
        self.tree1.commit(u'renamed, the new i18n man', rev_id='i18n-3',
843
828
                          committer=u'Erik B\xe5gfors')
844
829
 
845
830
        bundle = self.get_valid_bundle('i18n-2', 'i18n-3')
846
831
 
847
832
        # Removed
848
 
        self.tree1.remove([u'B\xe5gfors'])
 
833
        self.tree1.remove([u'bar'])
849
834
        self.tree1.commit(u'removed', rev_id='i18n-4')
850
835
 
851
836
        bundle = self.get_valid_bundle('i18n-3', 'i18n-4')
1583
1568
        record = record_iter.next()
1584
1569
        self.assertEqual((None, {'foo': 'bar', 'storage_kind': 'header'},
1585
1570
            'info', None, None), record)
1586
 
        self.assertRaises(BadBundle, record_iter.next)
 
1571
        self.assertRaises(errors.BadBundle, record_iter.next)
1587
1572
 
1588
1573
 
1589
1574
class TestReadMergeableFromUrl(TestCaseWithTransport):