~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_export.py

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009, 2010, 2011, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
46
46
    def test_empty(self):
47
47
        wt = self.make_branch_and_tree('.')
48
48
        export.export(wt, 'target', format="dir")
49
 
        self.assertEquals([], os.listdir("target"))
 
49
        self.assertEqual([], os.listdir("target"))
50
50
 
51
51
    def test_symlink(self):
52
52
        self.requireFeature(features.SymlinkFeature)
166
166
        export.export(tree, 'target', format='dir', subdir='subdir',
167
167
            per_file_timestamps=True)
168
168
        t = self.get_transport('target')
169
 
        self.assertEquals(foo_time, t.stat('foo.txt').st_mtime)
 
169
        self.assertEqual(foo_time, t.stat('foo.txt').st_mtime)
170
170
 
171
171
 
172
172
class TarExporterTests(tests.TestCaseWithTransport):
180
180
        wt.commit("1")
181
181
        export.export(wt, 'target.tar.xz', format="txz")
182
182
        tf = tarfile.open(fileobj=lzma.LZMAFile('target.tar.xz'))
183
 
        self.assertEquals(["target/a"], tf.getnames())
 
183
        self.assertEqual(["target/a"], tf.getnames())
184
184
 
185
185
    def test_lzma(self):
186
186
        self.requireFeature(features.lzma)
191
191
        wt.commit("1")
192
192
        export.export(wt, 'target.tar.lzma', format="tlzma")
193
193
        tf = tarfile.open(fileobj=lzma.LZMAFile('target.tar.lzma'))
194
 
        self.assertEquals(["target/a"], tf.getnames())
 
194
        self.assertEqual(["target/a"], tf.getnames())
195
195
 
196
196
    def test_tgz(self):
197
197
        wt = self.make_branch_and_tree('.')
200
200
        wt.commit("1")
201
201
        export.export(wt, 'target.tar.gz', format="tgz")
202
202
        tf = tarfile.open('target.tar.gz')
203
 
        self.assertEquals(["target/a"], tf.getnames())
 
203
        self.assertEqual(["target/a"], tf.getnames())
204
204
 
205
205
    def test_tgz_ignores_dest_path(self):
206
206
        # The target path should not be a part of the target file.
235
235
        wt.commit("1")
236
236
        export.export(wt, 'target.tar.bz2', format="tbz2")
237
237
        tf = tarfile.open('target.tar.bz2')
238
 
        self.assertEquals(["target/a"], tf.getnames())
 
238
        self.assertEqual(["target/a"], tf.getnames())
239
239
 
240
240
    def test_xz_stdout(self):
241
241
        wt = self.make_branch_and_tree('.')
259
259
        target.seek(0)
260
260
        ball2 = tarfile.open(None, "r", target)
261
261
        self.addCleanup(ball2.close)
262
 
        self.assertEquals(["bar/a"], ball2.getnames())
 
262
        self.assertEqual(["bar/a"], ball2.getnames())
263
263
 
264
264
 
265
265
class ZipExporterTests(tests.TestCaseWithTransport):
275
275
            per_file_timestamps=True)
276
276
        zfile = zipfile.ZipFile('test.zip')
277
277
        info = zfile.getinfo("test/har")
278
 
        self.assertEquals(time.localtime(timestamp)[:6], info.date_time)
 
278
        self.assertEqual(time.localtime(timestamp)[:6], info.date_time)
279
279
 
280
280
 
281
281
class RootNameTests(tests.TestCase):
282
282
 
283
283
    def test_root_name(self):
284
 
        self.assertEquals('mytest', get_root_name('../mytest.tar'))
285
 
        self.assertEquals('mytar', get_root_name('mytar.tar'))
286
 
        self.assertEquals('mytar', get_root_name('mytar.tar.bz2'))
287
 
        self.assertEquals('tar.tar.tar', get_root_name('tar.tar.tar.tgz'))
288
 
        self.assertEquals('bzr-0.0.5', get_root_name('bzr-0.0.5.tar.gz'))
289
 
        self.assertEquals('bzr-0.0.5', get_root_name('bzr-0.0.5.zip'))
290
 
        self.assertEquals('bzr-0.0.5', get_root_name('bzr-0.0.5'))
291
 
        self.assertEquals('mytar', get_root_name('a/long/path/mytar.tgz'))
292
 
        self.assertEquals('other',
 
284
        self.assertEqual('mytest', get_root_name('../mytest.tar'))
 
285
        self.assertEqual('mytar', get_root_name('mytar.tar'))
 
286
        self.assertEqual('mytar', get_root_name('mytar.tar.bz2'))
 
287
        self.assertEqual('tar.tar.tar', get_root_name('tar.tar.tar.tgz'))
 
288
        self.assertEqual('bzr-0.0.5', get_root_name('bzr-0.0.5.tar.gz'))
 
289
        self.assertEqual('bzr-0.0.5', get_root_name('bzr-0.0.5.zip'))
 
290
        self.assertEqual('bzr-0.0.5', get_root_name('bzr-0.0.5'))
 
291
        self.assertEqual('mytar', get_root_name('a/long/path/mytar.tgz'))
 
292
        self.assertEqual('other',
293
293
            get_root_name('../parent/../dir/other.tbz2'))
294
 
        self.assertEquals('', get_root_name('-'))
 
294
        self.assertEqual('', get_root_name('-'))