/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 breezy/tests/test_upstream_import.py

  • Committer: Jelmer Vernooij
  • Date: 2018-08-08 02:14:32 UTC
  • mfrom: (7063 work)
  • mto: This revision was merged to the branch mainline in revision 7065.
  • Revision ID: jelmer@jelmer.uk-20180808021432-nomib3je4cu2xqkm
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
        existing = fileobj.read()
67
67
        fileobj.seek(0)
68
68
        path = tempfile.mkdtemp(dir=os.getcwd())
69
 
        if existing != '':
 
69
        if existing != b'':
70
70
            # copytree requires the directory not to exist
71
71
            os.rmdir(path)
72
72
            copytree(existing, path)
73
 
        fileobj.write(path)
 
73
        fileobj.write(path.encode('utf-8'))
74
74
        self.root = path
75
75
 
76
76
    def add(self, path):
223
223
    def archive_test(self, builder, importer, subdir=False):
224
224
        archive_file = self.make_archive(builder, subdir)
225
225
        tree = BzrDir.create_standalone_workingtree('tree')
226
 
        tree.lock_write()
227
 
        try:
 
226
        with tree.lock_write():
228
227
            importer(tree, archive_file)
229
228
            self.assertTrue(tree.is_versioned('README'))
230
229
            self.assertTrue(tree.is_versioned('FEEDME'))
242
241
            # Ensure the second version of the file is used.
243
242
            self.assertEqual(tree.get_file_text('README'), b'Wow?')
244
243
            self.assertTrue(not os.path.exists(tree.abspath('FEEDME')))
245
 
        finally:
246
 
            tree.unlock()
247
 
 
248
244
 
249
245
    def test_untar2(self):
250
246
        tar_file = self.make_messed_tar()