~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_tree/test_export.py

  • Committer: Aaron Bentley
  • Date: 2011-04-28 21:14:17 UTC
  • mto: (5832.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5834.
  • Revision ID: aaron@aaronbentley.com-20110428211417-rdvfqzt8gtu14cer
Test directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2011 Canocal Ltd
 
1
# Copyright (C) 2011 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
17
17
from __future__ import with_statement
18
18
 
19
19
import contextlib
 
20
import tarfile
20
21
 
21
22
from bzrlib.export import export
22
23
from bzrlib.tests.per_tree import TestCaseWithTree
33
34
 
34
35
    def test_export_tar(self):
35
36
        work_a = self.make_branch_and_tree('wta')
36
 
        self.build_tree_contents([('wta/file', 'a\nb\nc\nd\n')])
 
37
        self.build_tree_contents(
 
38
            [('wta/file', 'a\nb\nc\nd\n'), ('wta/dir', '')])
37
39
        work_a.add('file', 'file-id')
 
40
        work_a.add('dir', 'dir-id')
38
41
        work_a.commit('add file')
39
 
        with write_locked(work_a):
40
 
            tree_a = self.workingtree_to_test_tree(work_a)
41
 
            export(tree_a, 'output', 'tar')
 
42
        tree_a = self.workingtree_to_test_tree(work_a)
 
43
        export(tree_a, 'output', 'tar')
 
44
        tf = tarfile.open('output')
 
45
        names = tf.getnames()
 
46
        self.assertIn('output/file', names)
 
47
        self.assertIn('output/dir', names)