1
# -*- coding: utf-8 -*-
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
"""Black-box tests for bzr export.
23
from bzrlib.branch import Branch
24
from bzrlib.tests.blackbox import ExternalBase
25
import tarfile, zipfile
27
class TestExport(ExternalBase):
29
def test_tar_export(self):
35
open('a', 'wb').write('foo\n')
37
self.runbzr('ignore something')
38
self.runbzr('commit -m 1')
39
self.runbzr('export test.tar.gz')
40
ball = tarfile.open('test.tar.gz')
41
for m in ball.getnames():
43
self.failIf(os.path.basename(m) == '.bzrignore', 'tar export contains .bzrignore')
45
def test_zip_export(self):
51
open('a', 'wb').write('foo\n')
53
self.runbzr('ignore something')
54
self.runbzr('commit -m 1')
55
self.runbzr('export test.zip')
56
ball = zipfile.ZipFile('test.zip')
57
for m in ball.namelist():
59
self.failIf(os.path.basename(m) == '.bzrignore', 'zip export contains .bzrignore')
61
def test_dir_export(self):
67
open('a', 'wb').write('foo\n')
69
self.runbzr('ignore something')
70
self.runbzr('commit -m 1')
71
self.runbzr('export direxport')
73
files = sorted(os.listdir('direxport'))
74
self.assertEqual(['a'], files, 'dir contains .bzrignore')