bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
5557.1.7
by John Arbash Meinel
Merge in the bzr.dev 5582 |
1 |
# Copyright (C) 2006-2011 Canonical Ltd
|
|
1685.1.76
by Wouter van Heyst
codecleanup |
2 |
#
|
|
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
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.
|
|
|
1685.1.76
by Wouter van Heyst
codecleanup |
7 |
#
|
|
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
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.
|
|
|
1685.1.76
by Wouter van Heyst
codecleanup |
12 |
#
|
|
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
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
|
|
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
16 |
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
17 |
"""Black-box tests for brz handling non-ascii characters."""
|
|
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
18 |
|
19 |
import os |
|
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
20 |
import sys |
|
1685.1.76
by Wouter van Heyst
codecleanup |
21 |
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
22 |
from breezy import ( |
|
4498.4.1
by Vincent Ladeuil
Various cleanups. |
23 |
osutils, |
24 |
tests, |
|
25 |
urlutils, |
|
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
26 |
)
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
27 |
from breezy.tests import EncodingAdapter |
28 |
from breezy.tests.scenarios import load_tests_apply_scenarios |
|
|
5559.2.2
by Martin Pool
Change to using standard load_tests_apply_scenarios. |
29 |
|
30 |
||
31 |
load_tests = load_tests_apply_scenarios |
|
|
4498.4.1
by Vincent Ladeuil
Various cleanups. |
32 |
|
33 |
||
34 |
class TestNonAscii(tests.TestCaseWithTransport): |
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
35 |
"""Test that brz handles files/committers/etc which are non-ascii.""" |
|
1185.85.67
by John Arbash Meinel
Starting work on a test adapter for multiple encodings. |
36 |
|
|
5559.2.2
by Martin Pool
Change to using standard load_tests_apply_scenarios. |
37 |
scenarios = EncodingAdapter.encoding_scenarios |
38 |
||
|
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
39 |
def setUp(self): |
40 |
super(TestNonAscii, self).setUp() |
|
|
4920.1.1
by Martin
Change bb.test_non_ascii tests to skip earlier and use addCleanup, as tearDown semantics have changed with testtools |
41 |
self._check_can_encode_paths() |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
42 |
|
|
4985.1.5
by Vincent Ladeuil
Deploying the new overrideAttr facility further reduces the complexity |
43 |
self.overrideAttr(osutils, '_cached_user_encoding', self.encoding) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
44 |
email = self.info['committer'] + ' <joe@foo.com>' |
|
6622.1.28
by Jelmer Vernooij
More renames; commands in output, environment variables. |
45 |
self.overrideEnv('BRZ_EMAIL', email.encode(osutils.get_user_encoding())) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
46 |
self.create_base() |
47 |
||
|
2823.2.4
by Daniel Watkins
Added 'working_dir' to 'run_bzr_decode'. |
48 |
def run_bzr_decode(self, args, encoding=None, fail=False, retcode=None, |
|
4498.4.1
by Vincent Ladeuil
Various cleanups. |
49 |
working_dir=None): |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
50 |
"""Run brz and decode the output into a particular encoding. |
|
2830.3.1
by Martin Pool
Make run_bzr_decode undeprecated again, but put it in the particular test class |
51 |
|
52 |
Returns a string containing the stdout output from bzr.
|
|
53 |
||
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
54 |
:param fail: If true, the operation is expected to fail with
|
|
2830.3.1
by Martin Pool
Make run_bzr_decode undeprecated again, but put it in the particular test class |
55 |
a UnicodeError.
|
56 |
"""
|
|
57 |
if encoding is None: |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
58 |
encoding = osutils.get_user_encoding() |
|
2830.3.1
by Martin Pool
Make run_bzr_decode undeprecated again, but put it in the particular test class |
59 |
try: |
|
6621.22.1
by Martin
Refactor bzrlib.ui to be based on unicode streams |
60 |
out = self.run_bzr(args, encoding=encoding, |
|
4498.4.1
by Vincent Ladeuil
Various cleanups. |
61 |
retcode=retcode, working_dir=working_dir)[0] |
|
2830.3.1
by Martin Pool
Make run_bzr_decode undeprecated again, but put it in the particular test class |
62 |
return out.decode(encoding) |
|
6619.3.2
by Jelmer Vernooij
Apply 2to3 except fix. |
63 |
except UnicodeError as e: |
|
2830.3.1
by Martin Pool
Make run_bzr_decode undeprecated again, but put it in the particular test class |
64 |
if not fail: |
65 |
raise
|
|
66 |
else: |
|
67 |
# This command, run from the regular command line, will give a
|
|
68 |
# traceback to the user. That's not really good for a situation
|
|
69 |
# that can be provoked just by the interaction of their input data
|
|
70 |
# and locale, as some of these are. What would be better?
|
|
71 |
if fail: |
|
72 |
self.fail("Expected UnicodeError not raised") |
|
73 |
||
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
74 |
def _check_OSX_can_roundtrip(self, path, fs_enc=None): |
75 |
"""Stop the test if it's about to fail or errors out. |
|
76 |
||
77 |
Until we get proper support on OSX for accented paths (in fact, any
|
|
78 |
path whose NFD decomposition is different than the NFC one), this is
|
|
79 |
the best way to keep test active (as opposed to disabling them
|
|
80 |
completely). This is a stop gap. The tests should at least be rewritten
|
|
|
4498.4.5
by Vincent Ladeuil
Fix comment. |
81 |
so that the failing ones are clearly separated from the passing ones.
|
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
82 |
"""
|
83 |
if fs_enc is None: |
|
84 |
fs_enc = osutils._fs_enc |
|
85 |
if sys.platform == 'darwin': |
|
86 |
encoded = path.encode(fs_enc) |
|
87 |
import unicodedata |
|
88 |
normal_thing = unicodedata.normalize('NFD', path) |
|
89 |
mac_encoded = normal_thing.encode(fs_enc) |
|
90 |
if mac_encoded != encoded: |
|
|
6050.1.2
by Martin
Make tests raising KnownFailure use the knownFailure method instead |
91 |
self.knownFailure( |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
92 |
'Unable to roundtrip path %r on OSX filesystem' |
93 |
' using encoding "%s"' |
|
94 |
% (path, fs_enc)) |
|
95 |
||
|
4920.1.1
by Martin
Change bb.test_non_ascii tests to skip earlier and use addCleanup, as tearDown semantics have changed with testtools |
96 |
def _check_can_encode_paths(self): |
|
4498.4.1
by Vincent Ladeuil
Various cleanups. |
97 |
fs_enc = osutils._fs_enc |
|
1711.4.11
by John Arbash Meinel
Skip non_ascii tests that won't write properly to the screen |
98 |
terminal_enc = osutils.get_terminal_encoding() |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
99 |
fname = self.info['filename'] |
|
1685.1.57
by Martin Pool
[broken] Skip unicode blackbox tests if not supported by filesystem |
100 |
dir_name = self.info['directory'] |
101 |
for thing in [fname, dir_name]: |
|
102 |
try: |
|
103 |
thing.encode(fs_enc) |
|
104 |
except UnicodeEncodeError: |
|
|
4498.4.1
by Vincent Ladeuil
Various cleanups. |
105 |
raise tests.TestSkipped( |
106 |
'Unable to represent path %r in filesystem encoding "%s"' |
|
107 |
% (thing, fs_enc)) |
|
|
1711.4.11
by John Arbash Meinel
Skip non_ascii tests that won't write properly to the screen |
108 |
try: |
109 |
thing.encode(terminal_enc) |
|
110 |
except UnicodeEncodeError: |
|
|
4498.4.1
by Vincent Ladeuil
Various cleanups. |
111 |
raise tests.TestSkipped( |
112 |
'Unable to represent path %r in terminal encoding "%s"' |
|
113 |
' (even though it is valid in filesystem encoding "%s")' |
|
114 |
% (thing, terminal_enc, fs_enc)) |
|
|
1685.1.74
by Wouter van Heyst
fix nonascii tests to run properly under LANG=C |
115 |
|
|
4920.1.1
by Martin
Change bb.test_non_ascii tests to skip earlier and use addCleanup, as tearDown semantics have changed with testtools |
116 |
def create_base(self): |
|
1836.2.1
by John Arbash Meinel
Switch setup to use internals rather than run_bzr |
117 |
wt = self.make_branch_and_tree('.') |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
118 |
self.build_tree_contents([('a', 'foo\n')]) |
|
1836.2.1
by John Arbash Meinel
Switch setup to use internals rather than run_bzr |
119 |
wt.add('a') |
120 |
wt.commit('adding a') |
|
|
1685.1.74
by Wouter van Heyst
fix nonascii tests to run properly under LANG=C |
121 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
122 |
self.build_tree_contents( |
123 |
[('b', 'non-ascii \xFF\xFF\xFC\xFB\x00 in b\n')]) |
|
|
1836.2.1
by John Arbash Meinel
Switch setup to use internals rather than run_bzr |
124 |
wt.add('b') |
125 |
wt.commit(self.info['message']) |
|
|
1685.1.74
by Wouter van Heyst
fix nonascii tests to run properly under LANG=C |
126 |
|
|
4920.1.1
by Martin
Change bb.test_non_ascii tests to skip earlier and use addCleanup, as tearDown semantics have changed with testtools |
127 |
fname = self.info['filename'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
128 |
self.build_tree_contents([(fname, 'unicode filename\n')]) |
|
1836.2.1
by John Arbash Meinel
Switch setup to use internals rather than run_bzr |
129 |
wt.add(fname) |
130 |
wt.commit(u'And a unicode file\n') |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
131 |
self.wt = wt |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
132 |
# FIXME: We don't check that the add went well, in fact, it doesn't on
|
133 |
# OSX (when LC_ALL is set correctly) because the added path doesn't
|
|
134 |
# match the one used on OSX. But checking here will require more
|
|
135 |
# invasive changes than adding the _check_OSX_can_roundtrip(), so I
|
|
136 |
# punt for now -- vila 20090702
|
|
|
1185.85.66
by John Arbash Meinel
Adding test for swedish |
137 |
|
|
1185.85.15
by John Arbash Meinel
Updated bzr status, adding test_cat |
138 |
def test_status(self): |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
139 |
self.build_tree_contents( |
140 |
[(self.info['filename'], 'changed something\n')]) |
|
141 |
txt = self.run_bzr_decode('status') |
|
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
142 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
143 |
self.assertEqual(u'modified:\n %s\n' % (self.info['filename'],), txt) |
|
1185.85.15
by John Arbash Meinel
Updated bzr status, adding test_cat |
144 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
145 |
txt = self.run_bzr_decode('status', encoding='ascii') |
|
1685.1.76
by Wouter van Heyst
codecleanup |
146 |
expected = u'modified:\n %s\n' % ( |
147 |
self.info['filename'].encode('ascii', 'replace'),) |
|
148 |
self.assertEqual(expected, txt) |
|
149 |
||
|
1185.85.15
by John Arbash Meinel
Updated bzr status, adding test_cat |
150 |
def test_cat(self): |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
151 |
# brz cat shouldn't change the contents
|
152 |
# using run_brz since that doesn't decode
|
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
153 |
txt = self.run_bzr('cat b')[0] |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
154 |
self.assertEqual('non-ascii \xFF\xFF\xFC\xFB\x00 in b\n', txt) |
|
1185.85.15
by John Arbash Meinel
Updated bzr status, adding test_cat |
155 |
|
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
156 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
157 |
txt = self.run_bzr(['cat', self.info['filename']])[0] |
|
1185.85.41
by John Arbash Meinel
Changing test_non_ascii.py so that it will keep trying even if it can't encode one piece. |
158 |
self.assertEqual('unicode filename\n', txt) |
|
1185.85.17
by John Arbash Meinel
switching to using the default encoding instead of utf-8 |
159 |
|
160 |
def test_cat_revision(self): |
|
|
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
161 |
committer = self.info['committer'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
162 |
txt = self.run_bzr_decode('cat-revision -r 1') |
|
5784.1.1
by Martin Pool
Stop using failIf, failUnless, etc |
163 |
self.assertTrue(committer in txt, |
|
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
164 |
'failed to find %r in %r' % (committer, txt)) |
|
1185.85.17
by John Arbash Meinel
switching to using the default encoding instead of utf-8 |
165 |
|
|
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
166 |
msg = self.info['message'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
167 |
txt = self.run_bzr_decode('cat-revision -r 2') |
|
5784.1.1
by Martin Pool
Stop using failIf, failUnless, etc |
168 |
self.assertTrue(msg in txt, 'failed to find %r in %r' % (msg, txt)) |
|
1185.85.18
by John Arbash Meinel
Updated mkdir, added to test_log |
169 |
|
170 |
def test_mkdir(self): |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
171 |
txt = self.run_bzr_decode(['mkdir', self.info['directory']]) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
172 |
self.assertEqual(u'added %s\n' % self.info['directory'], txt) |
173 |
||
174 |
# The text should be garbled, but the command should succeed
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
175 |
txt = self.run_bzr_decode(['mkdir', self.info['directory'] + '2'], |
176 |
encoding='ascii') |
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
177 |
expected = u'added %s2\n' % (self.info['directory'],) |
178 |
expected = expected.encode('ascii', 'replace') |
|
179 |
self.assertEqual(expected, txt) |
|
|
1185.85.19
by John Arbash Meinel
Updated bzr relpath |
180 |
|
181 |
def test_relpath(self): |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
182 |
txt = self.run_bzr_decode(['relpath', self.info['filename']]) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
183 |
self.assertEqual(self.info['filename'] + '\n', txt) |
|
1185.85.19
by John Arbash Meinel
Updated bzr relpath |
184 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
185 |
self.run_bzr_decode(['relpath', self.info['filename']], |
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
186 |
encoding='ascii', fail=True) |
|
1185.85.22
by John Arbash Meinel
Updated cmd_inventory. Changing from having each Command request an encoded stdout to providing one before calling run() |
187 |
|
188 |
def test_inventory(self): |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
189 |
txt = self.run_bzr_decode('inventory') |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
190 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
191 |
self.assertEqual(['a', 'b', self.info['filename']], |
|
1185.85.22
by John Arbash Meinel
Updated cmd_inventory. Changing from having each Command request an encoded stdout to providing one before calling run() |
192 |
txt.splitlines()) |
193 |
||
|
1185.85.23
by John Arbash Meinel
Adding more inventory tests. |
194 |
# inventory should fail if unable to encode
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
195 |
self.run_bzr_decode('inventory', encoding='ascii', fail=True) |
|
1185.85.23
by John Arbash Meinel
Adding more inventory tests. |
196 |
|
197 |
# We don't really care about the ids themselves,
|
|
198 |
# but the command shouldn't fail
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
199 |
txt = self.run_bzr_decode('inventory --show-ids') |
|
1185.85.24
by John Arbash Meinel
Moved run_bzr_decode into TestCase |
200 |
|
201 |
def test_revno(self): |
|
202 |
# There isn't a lot to test here, since revno should always
|
|
203 |
# be an integer
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
204 |
self.assertEqual('3\n', self.run_bzr_decode('revno')) |
205 |
self.assertEqual('3\n', self.run_bzr_decode('revno', encoding='ascii')) |
|
|
1185.85.24
by John Arbash Meinel
Moved run_bzr_decode into TestCase |
206 |
|
207 |
def test_revision_info(self): |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
208 |
self.run_bzr_decode('revision-info -r 1') |
|
1185.85.24
by John Arbash Meinel
Moved run_bzr_decode into TestCase |
209 |
|
|
1685.1.76
by Wouter van Heyst
codecleanup |
210 |
# TODO: jam 20060105 If we support revisions with non-ascii characters,
|
211 |
# this should be strict and fail.
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
212 |
self.run_bzr_decode('revision-info -r 1', encoding='ascii') |
|
1185.85.25
by John Arbash Meinel
updated 'bzr mv' |
213 |
|
214 |
def test_mv(self): |
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
215 |
fname1 = self.info['filename'] |
216 |
fname2 = self.info['filename'] + '2' |
|
217 |
dirname = self.info['directory'] |
|
|
1185.85.26
by John Arbash Meinel
bzr mv should succeed even if it can't display the paths. |
218 |
|
|
1685.1.76
by Wouter van Heyst
codecleanup |
219 |
# fname1 already exists
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
220 |
self.run_bzr_decode(['mv', 'a', fname1], fail=True) |
|
1185.85.26
by John Arbash Meinel
bzr mv should succeed even if it can't display the paths. |
221 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
222 |
txt = self.run_bzr_decode(['mv', 'a', fname2]) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
223 |
self.assertEqual(u'a => %s\n' % fname2, txt) |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
224 |
self.assertPathDoesNotExist('a') |
225 |
self.assertPathExists(fname2) |
|
|
1185.85.25
by John Arbash Meinel
updated 'bzr mv' |
226 |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
227 |
# After 'mv' we need to re-open the working tree
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
228 |
self.wt = self.wt.controldir.open_workingtree() |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
229 |
self.wt.commit('renamed to non-ascii') |
|
1185.85.25
by John Arbash Meinel
updated 'bzr mv' |
230 |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
231 |
os.mkdir(dirname) |
232 |
self.wt.add(dirname) |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
233 |
txt = self.run_bzr_decode(['mv', fname1, fname2, dirname]) |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
234 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
235 |
self.assertEqual([u'%s => %s/%s' % (fname1, dirname, fname1), |
236 |
u'%s => %s/%s' % (fname2, dirname, fname2)] |
|
|
1185.85.26
by John Arbash Meinel
bzr mv should succeed even if it can't display the paths. |
237 |
, txt.splitlines()) |
238 |
||
239 |
# The rename should still succeed
|
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
240 |
newpath = u'%s/%s' % (dirname, fname2) |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
241 |
txt = self.run_bzr_decode(['mv', newpath, 'a'], encoding='ascii') |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
242 |
self.assertPathExists('a') |
|
1685.1.2
by John Arbash Meinel
Re-enabling the non_ascii tests after fixing trace.py, bzr ignore also does the right thing now |
243 |
self.assertEqual(newpath.encode('ascii', 'replace') + ' => a\n', txt) |
|
1185.85.26
by John Arbash Meinel
bzr mv should succeed even if it can't display the paths. |
244 |
|
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
245 |
def test_branch(self): |
246 |
# We should be able to branch into a directory that
|
|
247 |
# has a unicode name, even if we can't display the name
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
248 |
self.run_bzr_decode(['branch', u'.', self.info['directory']]) |
249 |
self.run_bzr_decode(['branch', u'.', self.info['directory'] + '2'], |
|
250 |
encoding='ascii') |
|
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
251 |
|
252 |
def test_pull(self): |
|
253 |
# Make sure we can pull from paths that can't be encoded
|
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
254 |
dirname1 = self.info['directory'] |
255 |
dirname2 = self.info['directory'] + '2' |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
256 |
url1 = urlutils.local_path_to_url(dirname1) |
257 |
url2 = urlutils.local_path_to_url(dirname2) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
258 |
out_bzrdir = self.wt.controldir.sprout(url1) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
259 |
out_bzrdir.sprout(url2) |
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
260 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
261 |
self.build_tree_contents( |
262 |
[(osutils.pathjoin(dirname1, "a"), 'different text\n')]) |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
263 |
self.wt.commit('mod a') |
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
264 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
265 |
txt = self.run_bzr_decode('pull', working_dir=dirname2) |
266 |
||
267 |
expected = osutils.pathjoin(osutils.getcwd(), dirname1) |
|
|
3596.3.1
by James Westby
Give the user a bit more information about which saved location is being used. |
268 |
self.assertEqual(u'Using saved parent location: %s/\n' |
|
6112.4.7
by Jelmer Vernooij
Fix tests. |
269 |
'No revisions or tags to pull.\n' % (expected,), txt) |
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
270 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
271 |
self.build_tree_contents( |
272 |
[(osutils.pathjoin(dirname1, 'a'), 'and yet more\n')]) |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
273 |
self.wt.commit(u'modifying a by ' + self.info['committer']) |
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
274 |
|
275 |
# We should be able to pull, even if our encoding is bad
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
276 |
self.run_bzr_decode('pull --verbose', encoding='ascii', |
277 |
working_dir=dirname2) |
|
|
1185.85.31
by John Arbash Meinel
Updated bzr push, including bringing in the unused --verbose flag. |
278 |
|
279 |
def test_push(self): |
|
280 |
# TODO: Test push to an SFTP location
|
|
281 |
# Make sure we can pull from paths that can't be encoded
|
|
|
1685.1.24
by John Arbash Meinel
cmd_push should use URLs throughout. |
282 |
# TODO: jam 20060427 For drastically improving performance, we probably
|
283 |
# could create a local repository, so it wouldn't have to copy
|
|
284 |
# the files around as much.
|
|
|
4523.4.18
by John Arbash Meinel
tracked down a few more blackbox test cases that were using push. |
285 |
# Note that the tests don't actually fail, but if we don't set this
|
286 |
# flag, we end up getting "Lock was not Unlocked" warnings
|
|
|
1685.1.24
by John Arbash Meinel
cmd_push should use URLs throughout. |
287 |
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
288 |
dirname = self.info['directory'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
289 |
self.run_bzr_decode(['push', dirname]) |
|
1185.85.31
by John Arbash Meinel
Updated bzr push, including bringing in the unused --verbose flag. |
290 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
291 |
self.build_tree_contents([('a', 'adding more text\n')]) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
292 |
self.wt.commit('added some stuff') |
|
1185.85.31
by John Arbash Meinel
Updated bzr push, including bringing in the unused --verbose flag. |
293 |
|
|
1685.1.76
by Wouter van Heyst
codecleanup |
294 |
# TODO: check the output text is properly encoded
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
295 |
self.run_bzr_decode('push') |
|
1185.85.31
by John Arbash Meinel
Updated bzr push, including bringing in the unused --verbose flag. |
296 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
297 |
self.build_tree_contents( |
298 |
[('a', 'and a bit more: \n%s\n' % (dirname.encode('utf-8'),))]) |
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
299 |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
300 |
self.wt.commit('Added some ' + dirname) |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
301 |
self.run_bzr_decode('push --verbose', encoding='ascii') |
302 |
||
303 |
self.run_bzr_decode(['push', '--verbose', dirname + '2']) |
|
304 |
||
305 |
self.run_bzr_decode(['push', '--verbose', dirname + '3'], |
|
306 |
encoding='ascii') |
|
307 |
||
308 |
self.run_bzr_decode(['push', '--verbose', '--create-prefix', |
|
309 |
dirname + '4/' + dirname + '5']) |
|
310 |
self.run_bzr_decode(['push', '--verbose', '--create-prefix', |
|
311 |
dirname + '6/' + dirname + '7'], encoding='ascii') |
|
|
1685.1.24
by John Arbash Meinel
cmd_push should use URLs throughout. |
312 |
|
|
1185.85.32
by John Arbash Meinel
Updated bzr renames |
313 |
def test_renames(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
314 |
fname = self.info['filename'] + '2' |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
315 |
self.wt.rename_one('a', fname) |
316 |
txt = self.run_bzr_decode('renames') |
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
317 |
self.assertEqual(u'a => %s\n' % fname, txt) |
|
1185.85.32
by John Arbash Meinel
Updated bzr renames |
318 |
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
319 |
self.run_bzr_decode('renames', fail=True, encoding='ascii') |
|
1185.85.32
by John Arbash Meinel
Updated bzr renames |
320 |
|
|
1185.85.33
by John Arbash Meinel
Updated bzr remove, still remove --verbose still broken. |
321 |
def test_remove(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
322 |
fname = self.info['filename'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
323 |
txt = self.run_bzr_decode(['remove', fname], encoding='ascii') |
|
1185.85.33
by John Arbash Meinel
Updated bzr remove, still remove --verbose still broken. |
324 |
|
325 |
def test_remove_verbose(self): |
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
326 |
fname = self.info['filename'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
327 |
txt = self.run_bzr_decode(['remove', '--verbose', fname], |
328 |
encoding='ascii') |
|
|
1185.85.33
by John Arbash Meinel
Updated bzr remove, still remove --verbose still broken. |
329 |
|
|
1185.85.34
by John Arbash Meinel
Updating 'bzr file-id' exposed that we weren't allowing unicode file ids. Enabling them reveals a lot more bugs. |
330 |
def test_file_id(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
331 |
fname = self.info['filename'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
332 |
txt = self.run_bzr_decode(['file-id', fname]) |
|
1185.85.34
by John Arbash Meinel
Updating 'bzr file-id' exposed that we weren't allowing unicode file ids. Enabling them reveals a lot more bugs. |
333 |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
334 |
# TODO: jam 20060106 We don't support non-ascii file ids yet,
|
|
1185.85.35
by John Arbash Meinel
Updated file-path |
335 |
# so there is nothing which would fail in ascii encoding
|
336 |
# This *should* be retcode=3
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
337 |
txt = self.run_bzr_decode(['file-id', fname], encoding='ascii') |
|
1185.85.34
by John Arbash Meinel
Updating 'bzr file-id' exposed that we weren't allowing unicode file ids. Enabling them reveals a lot more bugs. |
338 |
|
|
1185.85.35
by John Arbash Meinel
Updated file-path |
339 |
def test_file_path(self): |
340 |
# Create a directory structure
|
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
341 |
fname = self.info['filename'] |
|
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
342 |
dirname = self.info['directory'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
343 |
self.build_tree_contents([ |
344 |
('base/', ), |
|
345 |
(osutils.pathjoin('base', '%s/' % (dirname,)), )]) |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
346 |
self.wt.add('base') |
347 |
self.wt.add('base/'+dirname) |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
348 |
path = osutils.pathjoin('base', dirname, fname) |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
349 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
350 |
self.wt.rename_one(fname, path) |
351 |
self.wt.commit('moving things around') |
|
|
1185.85.35
by John Arbash Meinel
Updated file-path |
352 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
353 |
txt = self.run_bzr_decode(['file-path', path]) |
|
1185.85.35
by John Arbash Meinel
Updated file-path |
354 |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
355 |
# TODO: jam 20060106 We don't support non-ascii file ids yet,
|
|
1185.85.35
by John Arbash Meinel
Updated file-path |
356 |
# so there is nothing which would fail in ascii encoding
|
357 |
# This *should* be retcode=3
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
358 |
txt = self.run_bzr_decode(['file-path', path], encoding='ascii') |
|
1185.85.34
by John Arbash Meinel
Updating 'bzr file-id' exposed that we weren't allowing unicode file ids. Enabling them reveals a lot more bugs. |
359 |
|
|
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
360 |
def test_revision_history(self): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
361 |
# TODO: jam 20060106 We don't support non-ascii revision ids yet,
|
|
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
362 |
# so there is nothing which would fail in ascii encoding
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
363 |
txt = self.run_bzr_decode('revision-history') |
|
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
364 |
|
365 |
def test_ancestry(self): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
366 |
# TODO: jam 20060106 We don't support non-ascii revision ids yet,
|
|
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
367 |
# so there is nothing which would fail in ascii encoding
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
368 |
txt = self.run_bzr_decode('ancestry') |
|
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
369 |
|
370 |
def test_diff(self): |
|
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
371 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
372 |
# TODO: jam 20060106 diff is a difficult one to test, because it
|
|
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
373 |
# shouldn't encode the file contents, but it needs some sort
|
374 |
# of encoding for the paths, etc which are displayed.
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
375 |
self.build_tree_contents([(self.info['filename'], 'newline\n')]) |
|
1685.1.78
by Wouter van Heyst
more code cleanup |
376 |
txt = self.run_bzr('diff', retcode=1)[0] |
|
1185.85.41
by John Arbash Meinel
Changing test_non_ascii.py so that it will keep trying even if it can't encode one piece. |
377 |
|
|
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
378 |
def test_deleted(self): |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
379 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
380 |
fname = self.info['filename'] |
|
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
381 |
os.remove(fname) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
382 |
self.wt.remove(fname) |
|
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
383 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
384 |
txt = self.run_bzr_decode('deleted') |
|
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
385 |
self.assertEqual(fname+'\n', txt) |
386 |
||
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
387 |
txt = self.run_bzr_decode('deleted --show-ids') |
|
5784.1.1
by Martin Pool
Stop using failIf, failUnless, etc |
388 |
self.assertTrue(txt.startswith(fname)) |
|
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
389 |
|
|
1185.85.51
by John Arbash Meinel
Adding tests to make sure deleted and modified fail if cannot encode names. |
390 |
# Deleted should fail if cannot decode
|
391 |
# Because it is giving the exact paths
|
|
392 |
# which might be used by a front end
|
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
393 |
self.run_bzr_decode('deleted', encoding='ascii', fail=True) |
|
1185.85.51
by John Arbash Meinel
Adding tests to make sure deleted and modified fail if cannot encode names. |
394 |
|
|
1185.85.50
by John Arbash Meinel
Updated cmd_modified |
395 |
def test_modified(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
396 |
fname = self.info['filename'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
397 |
self.build_tree_contents([(fname, 'modified\n')]) |
|
1185.85.50
by John Arbash Meinel
Updated cmd_modified |
398 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
399 |
txt = self.run_bzr_decode('modified') |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
400 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
3251.6.3
by Adrian Wilkins
Simplified and fixed test code |
401 |
self.assertEqual('"'+fname+'"'+'\n', txt) |
|
1185.85.50
by John Arbash Meinel
Updated cmd_modified |
402 |
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
403 |
self.run_bzr_decode('modified', encoding='ascii', fail=True) |
|
1185.85.51
by John Arbash Meinel
Adding tests to make sure deleted and modified fail if cannot encode names. |
404 |
|
|
1185.85.52
by John Arbash Meinel
Updated cmd_added, which obviously had no tests, because it had a bug in it. |
405 |
def test_added(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
406 |
fname = self.info['filename'] + '2' |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
407 |
self.build_tree_contents([(fname, 'added\n')]) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
408 |
self.wt.add(fname) |
|
1185.85.52
by John Arbash Meinel
Updated cmd_added, which obviously had no tests, because it had a bug in it. |
409 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
410 |
txt = self.run_bzr_decode('added') |
|
3251.6.3
by Adrian Wilkins
Simplified and fixed test code |
411 |
self.assertEqual('"'+fname+'"'+'\n', txt) |
|
1185.85.52
by John Arbash Meinel
Updated cmd_added, which obviously had no tests, because it had a bug in it. |
412 |
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
413 |
self.run_bzr_decode('added', encoding='ascii', fail=True) |
|
1185.85.52
by John Arbash Meinel
Updated cmd_added, which obviously had no tests, because it had a bug in it. |
414 |
|
|
1185.85.53
by John Arbash Meinel
Updated cmd_root |
415 |
def test_root(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
416 |
dirname = self.info['directory'] |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
417 |
url = urlutils.local_path_to_url(dirname) |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
418 |
self.run_bzr_decode('root') |
|
1185.85.53
by John Arbash Meinel
Updated cmd_root |
419 |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
420 |
self.wt.controldir.sprout(url) |
|
1185.85.53
by John Arbash Meinel
Updated cmd_root |
421 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
422 |
txt = self.run_bzr_decode('root', working_dir=dirname) |
|
5784.1.1
by Martin Pool
Stop using failIf, failUnless, etc |
423 |
self.assertTrue(txt.endswith(dirname+'\n')) |
|
1185.85.53
by John Arbash Meinel
Updated cmd_root |
424 |
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
425 |
txt = self.run_bzr_decode('root', encoding='ascii', fail=True, |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
426 |
working_dir=dirname) |
|
1185.85.53
by John Arbash Meinel
Updated cmd_root |
427 |
|
|
1185.85.54
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
428 |
def test_log(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
429 |
fname = self.info['filename'] |
430 |
||
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
431 |
txt = self.run_bzr_decode('log') |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
432 |
self.assertNotEqual(-1, txt.find(self.info['committer'])) |
433 |
self.assertNotEqual(-1, txt.find(self.info['message'])) |
|
|
1185.85.54
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
434 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
435 |
txt = self.run_bzr_decode('log --verbose') |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
436 |
# FIXME: iso-8859-2 test shouldn't be skipped here --vila 20090702
|
437 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
438 |
self.assertNotEqual(-1, txt.find(fname)) |
|
1185.85.54
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
439 |
|
440 |
# Make sure log doesn't fail even if we can't write out
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
441 |
txt = self.run_bzr_decode('log --verbose', encoding='ascii') |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
442 |
self.assertEqual(-1, txt.find(fname)) |
443 |
self.assertNotEqual(-1, txt.find(fname.encode('ascii', 'replace'))) |
|
|
1185.85.54
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
444 |
|
|
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
445 |
def test_touching_revisions(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
446 |
fname = self.info['filename'] |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
447 |
txt = self.run_bzr_decode(['touching-revisions', fname]) |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
448 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
449 |
self.assertEqual(u' 3 added %s\n' % (fname,), txt) |
450 |
||
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
451 |
fname2 = self.info['filename'] + '2' |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
452 |
self.wt.rename_one(fname, fname2) |
453 |
self.wt.commit(u'Renamed %s => %s' % (fname, fname2)) |
|
|
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
454 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
455 |
txt = self.run_bzr_decode(['touching-revisions', fname2]) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
456 |
expected_txt = (u' 3 added %s\n' |
|
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
457 |
u' 4 renamed %s => %s\n' |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
458 |
% (fname, fname, fname2)) |
|
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
459 |
self.assertEqual(expected_txt, txt) |
460 |
||
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
461 |
self.run_bzr_decode(['touching-revisions', fname2], encoding='ascii', |
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
462 |
fail=True) |
|
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
463 |
|
|
1185.85.56
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
464 |
def test_ls(self): |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
465 |
txt = self.run_bzr_decode('ls') |
|
1830.3.10
by John Arbash Meinel
Don't compare direct output of ls, sort first |
466 |
self.assertEqual(sorted(['a', 'b', self.info['filename']]), |
467 |
sorted(txt.splitlines())) |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
468 |
txt = self.run_bzr_decode('ls --null') |
|
1830.3.10
by John Arbash Meinel
Don't compare direct output of ls, sort first |
469 |
self.assertEqual(sorted(['', 'a', 'b', self.info['filename']]), |
470 |
sorted(txt.split('\0'))) |
|
|
1185.85.56
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
471 |
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
472 |
txt = self.run_bzr_decode('ls', encoding='ascii', fail=True) |
473 |
txt = self.run_bzr_decode('ls --null', encoding='ascii', fail=True) |
|
|
1185.85.56
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
474 |
|
|
1185.85.57
by John Arbash Meinel
Updated cmd_unknowns |
475 |
def test_unknowns(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
476 |
fname = self.info['filename'] + '2' |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
477 |
self.build_tree_contents([(fname, 'unknown\n')]) |
|
1185.85.57
by John Arbash Meinel
Updated cmd_unknowns |
478 |
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
479 |
# TODO: jam 20060112 brz unknowns is the only one which
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
480 |
# quotes paths do we really want it to?
|
|
3251.6.3
by Adrian Wilkins
Simplified and fixed test code |
481 |
# awilkins 20080521 added and modified do it now as well
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
482 |
txt = self.run_bzr_decode('unknowns') |
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
483 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
1185.85.57
by John Arbash Meinel
Updated cmd_unknowns |
484 |
self.assertEqual(u'"%s"\n' % (fname,), txt) |
485 |
||
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
486 |
self.run_bzr_decode('unknowns', encoding='ascii', fail=True) |
|
1185.85.57
by John Arbash Meinel
Updated cmd_unknowns |
487 |
|
|
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
488 |
def test_ignore(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
489 |
fname2 = self.info['filename'] + '2.txt' |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
490 |
self.build_tree_contents([(fname2, 'ignored\n')]) |
|
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
491 |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
492 |
def check_unknowns(expected): |
493 |
self.assertEqual(expected, list(self.wt.unknowns())) |
|
494 |
||
|
4498.4.3
by Vincent Ladeuil
Try to stop failing tests as late as possible on OSX. |
495 |
self._check_OSX_can_roundtrip(self.info['filename']) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
496 |
check_unknowns([fname2]) |
|
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
497 |
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
498 |
self.run_bzr_decode(['ignore', './' + fname2]) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
499 |
check_unknowns([]) |
|
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
500 |
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
501 |
fname3 = self.info['filename'] + '3.txt' |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
502 |
self.build_tree_contents([(fname3, 'unknown 3\n')]) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
503 |
check_unknowns([fname3]) |
|
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
504 |
|
505 |
# Ignore should not care what the encoding is
|
|
506 |
# (right now it doesn't print anything)
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
507 |
self.run_bzr_decode(['ignore', fname3], encoding='ascii') |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
508 |
check_unknowns([]) |
|
1185.85.59
by John Arbash Meinel
Adding extra tests for future corrections to WorkingTree.is_ignored() |
509 |
|
510 |
# Now try a wildcard match
|
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
511 |
fname4 = self.info['filename'] + '4.txt' |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
512 |
self.build_tree_contents([(fname4, 'unknown 4\n')]) |
513 |
self.run_bzr_decode('ignore *.txt') |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
514 |
check_unknowns([]) |
|
1185.85.53
by John Arbash Meinel
Updated cmd_root |
515 |
|
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
516 |
# and a different wildcard that matches everything
|
|
1185.85.59
by John Arbash Meinel
Adding extra tests for future corrections to WorkingTree.is_ignored() |
517 |
os.remove('.bzrignore') |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
518 |
self.run_bzr_decode(['ignore', self.info['filename'] + '*']) |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
519 |
check_unknowns([]) |
|
1185.85.59
by John Arbash Meinel
Adding extra tests for future corrections to WorkingTree.is_ignored() |
520 |
|
|
1816.1.1
by Alexander Belchenko
blackbox test for non-ascii behaviour of missing command |
521 |
def test_missing(self): |
522 |
# create empty tree as reference for missing
|
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
523 |
self.make_branch_and_tree('empty-tree') |
|
1816.1.1
by Alexander Belchenko
blackbox test for non-ascii behaviour of missing command |
524 |
|
525 |
msg = self.info['message'] |
|
526 |
||
|
2823.2.3
by Daniel Watkins
Removed erroneous retcodes. |
527 |
txt = self.run_bzr_decode('missing empty-tree') |
|
1816.1.1
by Alexander Belchenko
blackbox test for non-ascii behaviour of missing command |
528 |
self.assertNotEqual(-1, txt.find(self.info['committer'])) |
529 |
self.assertNotEqual(-1, txt.find(msg)) |
|
530 |
||
531 |
# Make sure missing doesn't fail even if we can't write out
|
|
|
2823.2.3
by Daniel Watkins
Removed erroneous retcodes. |
532 |
txt = self.run_bzr_decode('missing empty-tree', encoding='ascii') |
|
1816.1.1
by Alexander Belchenko
blackbox test for non-ascii behaviour of missing command |
533 |
self.assertEqual(-1, txt.find(msg)) |
534 |
self.assertNotEqual(-1, txt.find(msg.encode('ascii', 'replace'))) |
|
|
2904.3.1
by Lukáš Lalinský
Unicode-safe output from ``bzr info``. |
535 |
|
536 |
def test_info(self): |
|
|
2904.3.2
by Lukáš Lalinský
More details in NEWS and use full self.run_bzr_decode name in the test. |
537 |
self.run_bzr_decode(['branch', u'.', self.info['directory']]) |
538 |
self.run_bzr_decode(['info', self.info['directory']]) |
|
539 |
self.run_bzr_decode(['info', self.info['directory']], |
|
540 |
encoding='ascii') |
|
|
3123.2.1
by Lukáš Lalinský
Use self.outf instead of sys.stdout in cmd_ignored. |
541 |
|
542 |
def test_ignored(self): |
|
543 |
fname = self.info['filename'] + '1.txt' |
|
544 |
self.build_tree_contents([(fname, 'ignored\n')]) |
|
545 |
self.run_bzr(['ignore', fname]) |
|
546 |
txt = self.run_bzr_decode(['ignored']) |
|
547 |
self.assertEqual(txt, '%-50s %s\n' % (fname, fname)) |
|
548 |
txt = self.run_bzr_decode(['ignored'], encoding='ascii') |
|
549 |
fname = fname.encode('ascii', 'replace') |
|
550 |
self.assertEqual(txt, '%-50s %s\n' % (fname, fname)) |