/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/blackbox/test_export.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
 
"""Black-box tests for bzr export.
 
18
"""Black-box tests for brz export.
19
19
"""
20
20
 
21
 
from StringIO import StringIO
22
21
import os
23
22
import stat
24
23
import tarfile
26
25
import zipfile
27
26
 
28
27
 
29
 
from bzrlib import (
 
28
from ... import (
30
29
    export,
31
30
    )
32
 
from bzrlib.tests import (
 
31
from ...sixish import (
 
32
    BytesIO,
 
33
    )
 
34
from .. import (
33
35
    features,
34
36
    TestCaseWithTransport,
35
37
    )
36
 
from bzrlib.tests.matchers import ContainsNoVfsCalls
 
38
from ..matchers import ContainsNoVfsCalls
37
39
 
38
40
 
39
41
class TestExport(TestCaseWithTransport):
151
153
    def test_zip_export_stdout(self):
152
154
        tree = self.make_basic_tree()
153
155
        contents = self.run_bzr('export -d tree --format=zip -')[0]
154
 
        self.assertZipANameAndContent(zipfile.ZipFile(StringIO(contents)))
 
156
        self.assertZipANameAndContent(zipfile.ZipFile(BytesIO(contents)))
155
157
 
156
158
    def test_zip_export_file(self):
157
159
        tree = self.make_basic_tree()
180
182
        ball = tarfile.open(fname, mode=mode)
181
183
        self.assertTarANameAndContent(ball, root='test/')
182
184
        content = self.run_bzr('export -d tree --format=%s -' % (extension,))[0]
183
 
        ball = tarfile.open(mode=mode, fileobj=StringIO(content))
 
185
        ball = tarfile.open(mode=mode, fileobj=BytesIO(content))
184
186
        self.assertTarANameAndContent(ball, root='')
185
187
 
186
188
    def test_tar_export(self):
417
419
        tree.bzrdir.destroy_workingtree()
418
420
        os.chdir('branch')
419
421
        self.run_bzr_error(
420
 
            ['bzr: ERROR: --uncommitted requires a working tree'],
 
422
            ['brz: ERROR: --uncommitted requires a working tree'],
421
423
            'export --uncommitted latest')
422
424
 
423
425
    def test_zip_export_per_file_timestamps(self):