~bzr-pqm/bzr/bzr.dev

4020.1.4 by Aaron Bentley
Assign copyright, update tests.
1
# Copyright (C) 2005, 2009 Canonical Ltd
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
2
#
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.
7
#
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.
12
#
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
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
16
#
17
4020.1.5 by Aaron Bentley
Fix some formatting issues.
18
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
19
"""Tests of the 'bzr clean-tree' command."""
20
4020.1.5 by Aaron Bentley
Fix some formatting issues.
21
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
22
import os
23
24
from bzrlib.tests import TestCaseWithTransport
25
26
27
class TestBzrTools(TestCaseWithTransport):
28
29
    @staticmethod
30
    def touch(filename):
4020.1.4 by Aaron Bentley
Assign copyright, update tests.
31
        my_file = open(filename, 'wb')
32
        try:
33
            my_file.write('')
34
        finally:
35
            my_file.close()
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
36
37
    def test_clean_tree(self):
38
        self.run_bzr('init')
39
        self.run_bzr('ignore *~')
40
        self.run_bzr('ignore *.pyc')
41
        self.touch('name')
42
        self.touch('name~')
4020.1.7 by Aaron Bentley
Convert asserts to TestCase helper methods
43
        self.failUnlessExists('name~')
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
44
        self.touch('name.pyc')
45
        self.run_bzr('clean-tree --force')
4020.1.7 by Aaron Bentley
Convert asserts to TestCase helper methods
46
        self.failUnlessExists('name~')
47
        self.failIfExists('name')
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
48
        self.touch('name')
49
        self.run_bzr('clean-tree --detritus --force')
4020.1.7 by Aaron Bentley
Convert asserts to TestCase helper methods
50
        self.failUnlessExists('name')
51
        self.failIfExists('name~')
52
        self.failUnlessExists('name.pyc')
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
53
        self.run_bzr('clean-tree --ignored --force')
4020.1.7 by Aaron Bentley
Convert asserts to TestCase helper methods
54
        self.failUnlessExists('name')
55
        self.failIfExists('name.pyc')
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
56
        self.run_bzr('clean-tree --unknown --force')
4020.1.7 by Aaron Bentley
Convert asserts to TestCase helper methods
57
        self.failIfExists('name')
4020.1.2 by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests.
58
        self.touch('name')
59
        self.touch('name~')
60
        self.touch('name.pyc')
61
        self.run_bzr('clean-tree --unknown --ignored --force')
4020.1.7 by Aaron Bentley
Convert asserts to TestCase helper methods
62
        self.failIfExists('name')
63
        self.failIfExists('name~')
64
        self.failIfExists('name.pyc')