5171.3.7
by Martin von Gagern
Added blackbox tests for --directory option. |
1 |
# Copyright (C) 2005-2010 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 |
||
5195.4.1
by Alexander Belchenko
added test to illustrate bug https://bugs.launchpad.net/bzr/+bug/572098. Currently test failed as expected. |
24 |
from bzrlib import ignores |
4020.1.2
by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests. |
25 |
from bzrlib.tests import TestCaseWithTransport |
26 |
||
27 |
||
28 |
class TestBzrTools(TestCaseWithTransport): |
|
29 |
||
30 |
@staticmethod
|
|
31 |
def touch(filename): |
|
4020.1.4
by Aaron Bentley
Assign copyright, update tests. |
32 |
my_file = open(filename, 'wb') |
33 |
try: |
|
34 |
my_file.write('') |
|
35 |
finally: |
|
36 |
my_file.close() |
|
4020.1.2
by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests. |
37 |
|
38 |
def test_clean_tree(self): |
|
39 |
self.run_bzr('init') |
|
40 |
self.run_bzr('ignore *~') |
|
41 |
self.run_bzr('ignore *.pyc') |
|
42 |
self.touch('name') |
|
43 |
self.touch('name~') |
|
4020.1.7
by Aaron Bentley
Convert asserts to TestCase helper methods |
44 |
self.failUnlessExists('name~') |
4020.1.2
by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests. |
45 |
self.touch('name.pyc') |
46 |
self.run_bzr('clean-tree --force') |
|
4020.1.7
by Aaron Bentley
Convert asserts to TestCase helper methods |
47 |
self.failUnlessExists('name~') |
48 |
self.failIfExists('name') |
|
4020.1.2
by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests. |
49 |
self.touch('name') |
50 |
self.run_bzr('clean-tree --detritus --force') |
|
4020.1.7
by Aaron Bentley
Convert asserts to TestCase helper methods |
51 |
self.failUnlessExists('name') |
52 |
self.failIfExists('name~') |
|
53 |
self.failUnlessExists('name.pyc') |
|
4020.1.2
by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests. |
54 |
self.run_bzr('clean-tree --ignored --force') |
4020.1.7
by Aaron Bentley
Convert asserts to TestCase helper methods |
55 |
self.failUnlessExists('name') |
56 |
self.failIfExists('name.pyc') |
|
4020.1.2
by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests. |
57 |
self.run_bzr('clean-tree --unknown --force') |
4020.1.7
by Aaron Bentley
Convert asserts to TestCase helper methods |
58 |
self.failIfExists('name') |
4020.1.2
by Jelmer Vernooij
Import blackbox test for clean-tree, run regular tests. |
59 |
self.touch('name') |
60 |
self.touch('name~') |
|
61 |
self.touch('name.pyc') |
|
62 |
self.run_bzr('clean-tree --unknown --ignored --force') |
|
4020.1.7
by Aaron Bentley
Convert asserts to TestCase helper methods |
63 |
self.failIfExists('name') |
64 |
self.failIfExists('name~') |
|
65 |
self.failIfExists('name.pyc') |
|
5195.4.1
by Alexander Belchenko
added test to illustrate bug https://bugs.launchpad.net/bzr/+bug/572098. Currently test failed as expected. |
66 |
|
67 |
def test_clean_tree_nested_bzrdir(self): |
|
5195.4.5
by Alexander Belchenko
improved tests based on review of vila and parthm |
68 |
# clean-tree should not blindly delete nested bzrdirs (branches)
|
5195.4.1
by Alexander Belchenko
added test to illustrate bug https://bugs.launchpad.net/bzr/+bug/572098. Currently test failed as expected. |
69 |
# bug https://bugs.launchpad.net/bzr/+bug/572098
|
5195.4.5
by Alexander Belchenko
improved tests based on review of vila and parthm |
70 |
# so it will play well with scmproj/bzr-externals plugins.
|
5195.4.1
by Alexander Belchenko
added test to illustrate bug https://bugs.launchpad.net/bzr/+bug/572098. Currently test failed as expected. |
71 |
wt1 = self.make_branch_and_tree('.') |
72 |
wt2 = self.make_branch_and_tree('foo') |
|
73 |
wt3 = self.make_branch_and_tree('bar') |
|
74 |
ignores.tree_ignores_add_patterns(wt1, ['./foo']) |
|
5195.4.5
by Alexander Belchenko
improved tests based on review of vila and parthm |
75 |
self.run_bzr(['clean-tree', '--unknown', '--force']) |
5195.4.1
by Alexander Belchenko
added test to illustrate bug https://bugs.launchpad.net/bzr/+bug/572098. Currently test failed as expected. |
76 |
self.failUnlessExists('foo') |
77 |
self.failUnlessExists('bar') |
|
5195.4.5
by Alexander Belchenko
improved tests based on review of vila and parthm |
78 |
self.run_bzr(['clean-tree', '--ignored', '--force']) |
5195.4.1
by Alexander Belchenko
added test to illustrate bug https://bugs.launchpad.net/bzr/+bug/572098. Currently test failed as expected. |
79 |
self.failUnlessExists('foo') |
80 |
self.failUnlessExists('bar') |
|
5195.4.7
by Gary van der Merwe
Merge bzr.dev. |
81 |
|
5171.3.7
by Martin von Gagern
Added blackbox tests for --directory option. |
82 |
def test_clean_tree_directory(self): |
83 |
"""Test --directory option"""
|
|
84 |
tree = self.make_branch_and_tree('a') |
|
85 |
self.build_tree(['a/added', 'a/unknown', 'a/ignored']) |
|
86 |
tree.add('added') |
|
87 |
self.run_bzr('clean-tree -d a --unknown --ignored --force') |
|
88 |
self.failIfExists('a/unknown') |
|
89 |
self.failIfExists('a/ignored') |
|
90 |
self.failUnlessExists('a/added') |