bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2052.3.2
by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical |
1 |
# Copyright (C) 2006 Canonical Ltd
|
|
1185.62.15
by John Arbash Meinel
Adding fix + test for correct error message when not in branch. |
2 |
# -*- coding: utf-8 -*-
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
3 |
#
|
|
1185.62.15
by John Arbash Meinel
Adding fix + test for correct error message when not in branch. |
4 |
# This program is free software; you can redistribute it and/or modify
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
8 |
#
|
|
1185.62.15
by John Arbash Meinel
Adding fix + test for correct error message when not in branch. |
9 |
# This program is distributed in the hope that it will be useful,
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
13 |
#
|
|
1185.62.15
by John Arbash Meinel
Adding fix + test for correct error message when not in branch. |
14 |
# You should have received a copy of the GNU General Public License
|
15 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
1185.62.15
by John Arbash Meinel
Adding fix + test for correct error message when not in branch. |
17 |
|
18 |
||
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
19 |
"""Black-box tests for running brz outside of a working tree."""
|
|
1185.62.15
by John Arbash Meinel
Adding fix + test for correct error message when not in branch. |
20 |
|
21 |
import os |
|
22 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
23 |
from breezy import ( |
|
3199.1.3
by Vincent Ladeuil
Fix two more leaked tmp dirs. |
24 |
osutils, |
25 |
tests, |
|
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
26 |
transport, |
|
3199.1.3
by Vincent Ladeuil
Fix two more leaked tmp dirs. |
27 |
urlutils, |
28 |
)
|
|
29 |
||
30 |
||
31 |
class TestOutsideWT(tests.ChrootedTestCase): |
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
32 |
"""Test that brz gives proper errors outside of a working tree.""" |
|
1185.62.15
by John Arbash Meinel
Adding fix + test for correct error message when not in branch. |
33 |
|
|
1534.4.31
by Robert Collins
cleanedup test_outside_wt |
34 |
def test_cwd_log(self): |
|
4707.1.1
by Vincent Ladeuil
Fix OSX and FreeBSD failures. |
35 |
# Watch out for tricky test dir (on OSX /tmp -> /private/tmp)
|
36 |
tmp_dir = osutils.realpath(osutils.mkdtemp()) |
|
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
37 |
# We expect a read-to-root attempt to occur.
|
38 |
self.permit_url('file:///') |
|
|
4985.2.1
by Vincent Ladeuil
Deploy addAttrCleanup on the whole test suite. |
39 |
self.addCleanup(osutils.rmtree, tmp_dir) |
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
40 |
out, err = self.run_bzr('log', retcode=3, working_dir=tmp_dir) |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
41 |
self.assertEqual(u'brz: ERROR: Not a branch: "%s/".\n' |
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
42 |
% (tmp_dir,), |
|
1185.62.15
by John Arbash Meinel
Adding fix + test for correct error message when not in branch. |
43 |
err) |
44 |
||
|
1534.4.31
by Robert Collins
cleanedup test_outside_wt |
45 |
def test_url_log(self): |
46 |
url = self.get_readonly_url() + 'subdir/' |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
47 |
out, err = self.run_bzr(['log', url], retcode=3) |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
48 |
self.assertEqual(u'brz: ERROR: Not a branch:' |
|
2745.3.2
by Daniel Watkins
Updated tests to reflect new error text. |
49 |
u' "%s".\n' % url, err) |
|
1881.1.3
by Matthieu Moy
One missing blank line. |
50 |
|
|
3199.1.3
by Vincent Ladeuil
Fix two more leaked tmp dirs. |
51 |
def test_diff_outside_tree(self): |
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
52 |
tree = self.make_branch_and_tree('branch1') |
53 |
tree.commit('nothing') |
|
54 |
tree.commit('nothing') |
|
55 |
# A directory we can run commands from which we hope is not contained
|
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
56 |
# in a brz tree (though if there is one at or above $TEMPDIR, this is
|
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
57 |
# false and may cause test failures).
|
|
4707.1.1
by Vincent Ladeuil
Fix OSX and FreeBSD failures. |
58 |
# Watch out for tricky test dir (on OSX /tmp -> /private/tmp)
|
59 |
tmp_dir = osutils.realpath(osutils.mkdtemp()) |
|
|
4985.2.1
by Vincent Ladeuil
Deploy addAttrCleanup on the whole test suite. |
60 |
self.addCleanup(osutils.rmtree, tmp_dir) |
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
61 |
# We expect a read-to-root attempt to occur.
|
62 |
self.permit_url('file:///') |
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
63 |
expected_error = u'brz: ERROR: Not a branch: "%s/branch2/".\n' % tmp_dir |
|
1881.1.1
by Matthieu Moy
Fixed and tested "bzr diff" outside a working tree. |
64 |
# -r X..Y
|
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
65 |
out, err = self.run_bzr('diff -r revno:2:branch2..revno:1', retcode=3, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
66 |
working_dir=tmp_dir) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
67 |
self.assertEqual('', out) |
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
68 |
self.assertEqual(expected_error, err) |
|
1881.1.1
by Matthieu Moy
Fixed and tested "bzr diff" outside a working tree. |
69 |
# -r X
|
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
70 |
out, err = self.run_bzr('diff -r revno:2:branch2', retcode=3, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
71 |
working_dir=tmp_dir) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
72 |
self.assertEqual('', out) |
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
73 |
self.assertEqual(expected_error, err) |
|
1881.1.1
by Matthieu Moy
Fixed and tested "bzr diff" outside a working tree. |
74 |
# -r X..
|
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
75 |
out, err = self.run_bzr('diff -r revno:2:branch2..', retcode=3, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
76 |
working_dir=tmp_dir) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
77 |
self.assertEqual('', out) |
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
78 |
self.assertEqual(expected_error, err) |
|
1881.1.1
by Matthieu Moy
Fixed and tested "bzr diff" outside a working tree. |
79 |
# no -r at all.
|
|
4691.2.1
by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite. |
80 |
out, err = self.run_bzr('diff', retcode=3, working_dir=tmp_dir) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
81 |
self.assertEqual('', out) |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
82 |
self.assertEqual(u'brz: ERROR: Not a branch: "%s/".\n' % tmp_dir, err) |