~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_check.py

  • Committer: Jelmer Vernooij
  • Date: 2008-07-07 21:54:04 UTC
  • mto: This revision was merged to the branch mainline in revision 3533.
  • Revision ID: jelmer@samba.org-20080707215404-09t83ot6mv02jr6w
Move functionality to add ignores to the ignore file into a separate function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Tests for the 'check' CLI command."""
18
18
 
19
 
from bzrlib.tests import ChrootedTestCase
20
 
from bzrlib.tests import TestCaseWithTransport
21
 
 
22
 
 
23
 
class TestCheck(TestCaseWithTransport):
 
19
from bzrlib.tests.blackbox import ExternalBase
 
20
 
 
21
 
 
22
class TestCheck(ExternalBase):
24
23
 
25
24
    def test_check_no_tree(self):
26
25
        self.make_branch('.')
34
33
        tree = self.make_branch_and_tree('.')
35
34
        tree.commit('hallelujah')
36
35
        out, err = self.run_bzr('check')
37
 
        self.assertContainsRe(err, r"Checking working tree at '.*'\.\n")
38
 
        self.assertContainsRe(err, r"Checking repository at '.*'\.\n")
39
 
        # the root directory may be in the texts for rich root formats
40
 
        self.assertContainsRe(err, r"checked repository.*\n"
41
 
                                   r"     1 revisions\n"
42
 
                                   r"     [01] file-ids\n"
43
 
                                   )
44
 
        self.assertContainsRe(err, r"Checking branch at '.*'\.\n")
45
 
        self.assertContainsRe(err, r"checked branch.*")
46
 
 
47
 
    def test_check_branch(self):
48
 
        tree = self.make_branch_and_tree('.')
49
 
        tree.commit('foo')
50
 
        out, err = self.run_bzr('check --branch')
51
 
        self.assertContainsRe(err, r"^Checking branch at '.*'\.\n"
52
 
                                   r"checked branch.*")
53
 
 
54
 
    def test_check_repository(self):
55
 
        tree = self.make_branch_and_tree('.')
56
 
        tree.commit('foo')
57
 
        out, err = self.run_bzr('check --repo')
58
 
        self.assertContainsRe(err, r"^Checking repository at '.*'\.\n"
 
36
        self.assertContainsRe(err, r"^Checking working tree at '.*'\.\n"
 
37
                                   r"Checking repository at '.*'\.\n"
59
38
                                   r"checked repository.*\n"
60
39
                                   r"     1 revisions\n"
61
 
                                   r"     [01] file-ids\n"
62
 
                                   )
63
 
 
64
 
    def test_check_tree(self):
65
 
        tree = self.make_branch_and_tree('.')
66
 
        tree.commit('foo')
67
 
        out, err = self.run_bzr('check --tree')
68
 
        self.assertContainsRe(err, r"^Checking working tree at '.*'\.\n$")
69
 
 
70
 
    def test_partial_check(self):
71
 
        tree = self.make_branch_and_tree('.')
72
 
        tree.commit('foo')
73
 
        out, err = self.run_bzr('check --tree --branch')
74
 
        self.assertContainsRe(err, r"^Checking working tree at '.*'\.\n"
 
40
                                   r"     0 file-ids\n"
 
41
                                   r"     0 unique file texts\n"
 
42
                                   r"     0 repeated file texts\n"
 
43
                                   r"     0 unreferenced text versions\n"
75
44
                                   r"Checking branch at '.*'\.\n"
76
 
                                   r"checked branch.*")
77
 
 
78
 
    def test_check_missing_tree(self):
79
 
        branch = self.make_branch('.')
80
 
        out, err = self.run_bzr('check --tree')
81
 
        self.assertEqual(err, "No working tree found at specified location.\n")
82
 
 
83
 
    def test_check_missing_partial(self):
84
 
        branch = self.make_branch('.')
85
 
        out, err = self.run_bzr('check --tree --branch')
86
 
        self.assertContainsRe(err,
87
 
            r"Checking branch at '.*'\.\n"
88
 
            r"No working tree found at specified location\.\n"
89
 
            r"checked branch.*")
90
 
 
91
 
    def test_check_missing_branch_in_shared_repo(self):
92
 
        self.make_repository('shared', shared=True)
93
 
        out, err = self.run_bzr('check --branch shared')
94
 
        self.assertEqual(err, "No branch found at specified location.\n")
95
 
 
96
 
 
97
 
class ChrootedCheckTests(ChrootedTestCase):
98
 
 
99
 
    def test_check_missing_branch(self):
100
 
        out, err = self.run_bzr(
101
 
            'check --branch %s' % self.get_readonly_url(''))
102
 
        self.assertEqual(err, "No branch found at specified location.\n")
103
 
 
104
 
    def test_check_missing_repository(self):
105
 
        out, err = self.run_bzr('check --repo %s' % self.get_readonly_url(''))
106
 
        self.assertEqual(err, "No repository found at specified location.\n")
107
 
 
108
 
    def test_check_missing_everything(self):
109
 
        out, err = self.run_bzr('check %s' % self.get_readonly_url(''))
110
 
        self.assertEqual(err, "No working tree found at specified location.\n"
111
 
                              "No branch found at specified location.\n"
112
 
                              "No repository found at specified location.\n")
 
45
                                   r"checked branch.*\n$")