bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2830.3.1
by Martin Pool
Make run_bzr_decode undeprecated again, but put it in the particular test class |
1 |
# Copyright (C) 2006, 2007 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 |
|
1685.1.76
by Wouter van Heyst
codecleanup |
17 |
"""Black-box tests for bzr 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 sys |
|
20 |
import os |
|
1685.1.76
by Wouter van Heyst
codecleanup |
21 |
|
1987.1.2
by John Arbash Meinel
Remove the unneeded _set_user_ignores(['./.bazaar']) now that home has moved |
22 |
from bzrlib import osutils, urlutils |
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
23 |
from bzrlib.tests import ( |
24 |
TestCaseWithTransport, |
|
25 |
TestSkipped, |
|
26 |
multiply_tests, |
|
27 |
)
|
|
28 |
from bzrlib.tests.EncodingAdapter import encoding_scenarios |
|
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. |
29 |
from bzrlib.trace import mutter, note |
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
30 |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
31 |
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
32 |
def load_tests(standard_tests, module, loader): |
33 |
return multiply_tests(standard_tests, encoding_scenarios, |
|
34 |
loader.suiteClass()) |
|
35 |
||
36 |
||
1836.2.1
by John Arbash Meinel
Switch setup to use internals rather than run_bzr |
37 |
class TestNonAscii(TestCaseWithTransport): |
1185.85.67
by John Arbash Meinel
Starting work on a test adapter for multiple encodings. |
38 |
"""Test that bzr handles files/committers/etc which are non-ascii.""" |
39 |
||
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
40 |
def setUp(self): |
41 |
super(TestNonAscii, self).setUp() |
|
1861.4.1
by Matthieu Moy
BZREMAIL renamed to BZR_EMAIL. |
42 |
self._orig_email = os.environ.get('BZR_EMAIL', None) |
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
43 |
self._orig_encoding = osutils._cached_user_encoding |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
44 |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
45 |
osutils._cached_user_encoding = self.encoding |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
46 |
email = self.info['committer'] + ' <joe@foo.com>' |
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
47 |
os.environ['BZR_EMAIL'] = email.encode(osutils.get_user_encoding()) |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
48 |
self.create_base() |
49 |
||
50 |
def tearDown(self): |
|
51 |
if self._orig_email is not None: |
|
1861.4.1
by Matthieu Moy
BZREMAIL renamed to BZR_EMAIL. |
52 |
os.environ['BZR_EMAIL'] = self._orig_email |
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. |
53 |
else: |
1861.4.1
by Matthieu Moy
BZREMAIL renamed to BZR_EMAIL. |
54 |
if os.environ.get('BZR_EMAIL', None) is not None: |
55 |
del os.environ['BZR_EMAIL'] |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
56 |
osutils._cached_user_encoding = self._orig_encoding |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
57 |
super(TestNonAscii, self).tearDown() |
1185.85.10
by John Arbash Meinel
Adding a test case which uses non-ascii characters for email, filename, and commit message |
58 |
|
2823.2.4
by Daniel Watkins
Added 'working_dir' to 'run_bzr_decode'. |
59 |
def run_bzr_decode(self, args, encoding=None, fail=False, retcode=None, |
60 |
working_dir=None): |
|
2830.3.1
by Martin Pool
Make run_bzr_decode undeprecated again, but put it in the particular test class |
61 |
"""Run bzr and decode the output into a particular encoding. |
62 |
||
63 |
Returns a string containing the stdout output from bzr.
|
|
64 |
||
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
65 |
: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 |
66 |
a UnicodeError.
|
67 |
"""
|
|
68 |
if encoding is None: |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
69 |
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 |
70 |
try: |
71 |
out = self.run_bzr(args, output_encoding=encoding, encoding=encoding, |
|
2823.2.4
by Daniel Watkins
Added 'working_dir' to 'run_bzr_decode'. |
72 |
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 |
73 |
return out.decode(encoding) |
74 |
except UnicodeError, e: |
|
75 |
if not fail: |
|
76 |
raise
|
|
77 |
else: |
|
78 |
# This command, run from the regular command line, will give a
|
|
79 |
# traceback to the user. That's not really good for a situation
|
|
80 |
# that can be provoked just by the interaction of their input data
|
|
81 |
# and locale, as some of these are. What would be better?
|
|
82 |
if fail: |
|
83 |
self.fail("Expected UnicodeError not raised") |
|
84 |
||
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
85 |
def create_base(self): |
1685.1.57
by Martin Pool
[broken] Skip unicode blackbox tests if not supported by filesystem |
86 |
fs_enc = sys.getfilesystemencoding() |
1711.4.11
by John Arbash Meinel
Skip non_ascii tests that won't write properly to the screen |
87 |
terminal_enc = osutils.get_terminal_encoding() |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
88 |
fname = self.info['filename'] |
1685.1.57
by Martin Pool
[broken] Skip unicode blackbox tests if not supported by filesystem |
89 |
dir_name = self.info['directory'] |
90 |
for thing in [fname, dir_name]: |
|
91 |
try: |
|
92 |
thing.encode(fs_enc) |
|
93 |
except UnicodeEncodeError: |
|
94 |
raise TestSkipped(('Unable to represent path %r' |
|
1711.4.11
by John Arbash Meinel
Skip non_ascii tests that won't write properly to the screen |
95 |
' in filesystem encoding "%s"') |
1685.1.57
by Martin Pool
[broken] Skip unicode blackbox tests if not supported by filesystem |
96 |
% (thing, fs_enc)) |
1711.4.11
by John Arbash Meinel
Skip non_ascii tests that won't write properly to the screen |
97 |
try: |
98 |
thing.encode(terminal_enc) |
|
99 |
except UnicodeEncodeError: |
|
100 |
raise TestSkipped(('Unable to represent path %r' |
|
101 |
' in terminal encoding "%s"' |
|
102 |
' (even though it is valid in'
|
|
103 |
' filesystem encoding "%s")') |
|
104 |
% (thing, terminal_enc, fs_enc)) |
|
1685.1.74
by Wouter van Heyst
fix nonascii tests to run properly under LANG=C |
105 |
|
1836.2.1
by John Arbash Meinel
Switch setup to use internals rather than run_bzr |
106 |
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. |
107 |
self.build_tree_contents([('a', 'foo\n')]) |
1836.2.1
by John Arbash Meinel
Switch setup to use internals rather than run_bzr |
108 |
wt.add('a') |
109 |
wt.commit('adding a') |
|
1685.1.74
by Wouter van Heyst
fix nonascii tests to run properly under LANG=C |
110 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
111 |
self.build_tree_contents( |
112 |
[('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 |
113 |
wt.add('b') |
114 |
wt.commit(self.info['message']) |
|
1685.1.74
by Wouter van Heyst
fix nonascii tests to run properly under LANG=C |
115 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
116 |
self.build_tree_contents([(fname, 'unicode filename\n')]) |
1836.2.1
by John Arbash Meinel
Switch setup to use internals rather than run_bzr |
117 |
wt.add(fname) |
118 |
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. |
119 |
self.wt = wt |
1185.85.66
by John Arbash Meinel
Adding test for swedish |
120 |
|
1185.85.15
by John Arbash Meinel
Updated bzr status, adding test_cat |
121 |
def test_status(self): |
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 |
[(self.info['filename'], 'changed something\n')]) |
|
124 |
txt = self.run_bzr_decode('status') |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
125 |
self.assertEqual(u'modified:\n %s\n' % (self.info['filename'],), txt) |
1185.85.15
by John Arbash Meinel
Updated bzr status, adding test_cat |
126 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
127 |
txt = self.run_bzr_decode('status', encoding='ascii') |
1685.1.76
by Wouter van Heyst
codecleanup |
128 |
expected = u'modified:\n %s\n' % ( |
129 |
self.info['filename'].encode('ascii', 'replace'),) |
|
130 |
self.assertEqual(expected, txt) |
|
131 |
||
1185.85.15
by John Arbash Meinel
Updated bzr status, adding test_cat |
132 |
def test_cat(self): |
133 |
# bzr cat shouldn't change the contents
|
|
134 |
# using run_bzr since that doesn't decode
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
135 |
txt = self.run_bzr('cat b')[0] |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
136 |
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 |
137 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
138 |
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. |
139 |
self.assertEqual('unicode filename\n', txt) |
1185.85.17
by John Arbash Meinel
switching to using the default encoding instead of utf-8 |
140 |
|
141 |
def test_cat_revision(self): |
|
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
142 |
committer = self.info['committer'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
143 |
txt = self.run_bzr_decode('cat-revision -r 1') |
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
144 |
self.failUnless(committer in txt, |
145 |
'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 |
146 |
|
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
147 |
msg = self.info['message'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
148 |
txt = self.run_bzr_decode('cat-revision -r 2') |
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
149 |
self.failUnless(msg in txt, 'failed to find %r in %r' % (msg, txt)) |
1185.85.18
by John Arbash Meinel
Updated mkdir, added to test_log |
150 |
|
151 |
def test_mkdir(self): |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
152 |
txt = self.run_bzr_decode(['mkdir', self.info['directory']]) |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
153 |
self.assertEqual(u'added %s\n' % self.info['directory'], txt) |
154 |
||
155 |
# 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. |
156 |
txt = self.run_bzr_decode(['mkdir', self.info['directory'] + '2'], |
157 |
encoding='ascii') |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
158 |
expected = u'added %s2\n' % (self.info['directory'],) |
159 |
expected = expected.encode('ascii', 'replace') |
|
160 |
self.assertEqual(expected, txt) |
|
1185.85.19
by John Arbash Meinel
Updated bzr relpath |
161 |
|
162 |
def test_relpath(self): |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
163 |
txt = self.run_bzr_decode(['relpath', self.info['filename']]) |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
164 |
self.assertEqual(self.info['filename'] + '\n', txt) |
1185.85.19
by John Arbash Meinel
Updated bzr relpath |
165 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
166 |
self.run_bzr_decode(['relpath', self.info['filename']], |
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
167 |
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() |
168 |
|
169 |
def test_inventory(self): |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
170 |
txt = self.run_bzr_decode('inventory') |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
171 |
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() |
172 |
txt.splitlines()) |
173 |
||
1185.85.23
by John Arbash Meinel
Adding more inventory tests. |
174 |
# inventory should fail if unable to encode
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
175 |
self.run_bzr_decode('inventory', encoding='ascii', fail=True) |
1185.85.23
by John Arbash Meinel
Adding more inventory tests. |
176 |
|
177 |
# We don't really care about the ids themselves,
|
|
178 |
# 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. |
179 |
txt = self.run_bzr_decode('inventory --show-ids') |
1185.85.24
by John Arbash Meinel
Moved run_bzr_decode into TestCase |
180 |
|
181 |
def test_revno(self): |
|
182 |
# There isn't a lot to test here, since revno should always
|
|
183 |
# be an integer
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
184 |
self.assertEqual('3\n', self.run_bzr_decode('revno')) |
185 |
self.assertEqual('3\n', self.run_bzr_decode('revno', encoding='ascii')) |
|
1185.85.24
by John Arbash Meinel
Moved run_bzr_decode into TestCase |
186 |
|
187 |
def test_revision_info(self): |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
188 |
self.run_bzr_decode('revision-info -r 1') |
1185.85.24
by John Arbash Meinel
Moved run_bzr_decode into TestCase |
189 |
|
1685.1.76
by Wouter van Heyst
codecleanup |
190 |
# TODO: jam 20060105 If we support revisions with non-ascii characters,
|
191 |
# 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. |
192 |
self.run_bzr_decode('revision-info -r 1', encoding='ascii') |
1185.85.25
by John Arbash Meinel
updated 'bzr mv' |
193 |
|
194 |
def test_mv(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
195 |
fname1 = self.info['filename'] |
196 |
fname2 = self.info['filename'] + '2' |
|
197 |
dirname = self.info['directory'] |
|
1185.85.26
by John Arbash Meinel
bzr mv should succeed even if it can't display the paths. |
198 |
|
1685.1.76
by Wouter van Heyst
codecleanup |
199 |
# fname1 already exists
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
200 |
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. |
201 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
202 |
txt = self.run_bzr_decode(['mv', 'a', fname2]) |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
203 |
self.assertEqual(u'a => %s\n' % fname2, txt) |
1185.85.26
by John Arbash Meinel
bzr mv should succeed even if it can't display the paths. |
204 |
self.failIfExists('a') |
205 |
self.failUnlessExists(fname2) |
|
1185.85.25
by John Arbash Meinel
updated 'bzr mv' |
206 |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
207 |
# After 'mv' we need to re-open the working tree
|
208 |
self.wt = self.wt.bzrdir.open_workingtree() |
|
209 |
self.wt.commit('renamed to non-ascii') |
|
1185.85.25
by John Arbash Meinel
updated 'bzr mv' |
210 |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
211 |
os.mkdir(dirname) |
212 |
self.wt.add(dirname) |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
213 |
txt = self.run_bzr_decode(['mv', fname1, fname2, dirname]) |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
214 |
self.assertEqual([u'%s => %s/%s' % (fname1, dirname, fname1), |
215 |
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. |
216 |
, txt.splitlines()) |
217 |
||
218 |
# The rename should still succeed
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
219 |
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. |
220 |
txt = self.run_bzr_decode(['mv', newpath, 'a'], encoding='ascii') |
1185.85.26
by John Arbash Meinel
bzr mv should succeed even if it can't display the paths. |
221 |
self.failUnlessExists('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 |
222 |
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. |
223 |
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
224 |
def test_branch(self): |
225 |
# We should be able to branch into a directory that
|
|
226 |
# 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. |
227 |
self.run_bzr_decode(['branch', u'.', self.info['directory']]) |
228 |
self.run_bzr_decode(['branch', u'.', self.info['directory'] + '2'], |
|
229 |
encoding='ascii') |
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
230 |
|
231 |
def test_pull(self): |
|
232 |
# 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. |
233 |
dirname1 = self.info['directory'] |
234 |
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. |
235 |
url1 = urlutils.local_path_to_url(dirname1) |
236 |
url2 = urlutils.local_path_to_url(dirname2) |
|
237 |
out_bzrdir = self.wt.bzrdir.sprout(url1) |
|
238 |
out_bzrdir.sprout(url2) |
|
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
239 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
240 |
self.build_tree_contents( |
241 |
[(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. |
242 |
self.wt.commit('mod a') |
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
243 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
244 |
txt = self.run_bzr_decode('pull', working_dir=dirname2) |
245 |
||
246 |
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. |
247 |
self.assertEqual(u'Using saved parent location: %s/\n' |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
248 |
'No revisions to pull.\n' % (expected,), txt) |
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
249 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
250 |
self.build_tree_contents( |
251 |
[(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. |
252 |
self.wt.commit(u'modifying a by ' + self.info['committer']) |
1185.85.27
by John Arbash Meinel
Updated bzr branch and bzr pull |
253 |
|
254 |
# 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. |
255 |
self.run_bzr_decode('pull --verbose', encoding='ascii', |
256 |
working_dir=dirname2) |
|
1185.85.31
by John Arbash Meinel
Updated bzr push, including bringing in the unused --verbose flag. |
257 |
|
258 |
def test_push(self): |
|
259 |
# TODO: Test push to an SFTP location
|
|
260 |
# 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. |
261 |
# TODO: jam 20060427 For drastically improving performance, we probably
|
262 |
# could create a local repository, so it wouldn't have to copy
|
|
263 |
# the files around as much.
|
|
264 |
||
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
265 |
dirname = self.info['directory'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
266 |
self.run_bzr_decode(['push', dirname]) |
1185.85.31
by John Arbash Meinel
Updated bzr push, including bringing in the unused --verbose flag. |
267 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
268 |
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. |
269 |
self.wt.commit('added some stuff') |
1185.85.31
by John Arbash Meinel
Updated bzr push, including bringing in the unused --verbose flag. |
270 |
|
1685.1.76
by Wouter van Heyst
codecleanup |
271 |
# 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. |
272 |
self.run_bzr_decode('push') |
1185.85.31
by John Arbash Meinel
Updated bzr push, including bringing in the unused --verbose flag. |
273 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
274 |
self.build_tree_contents( |
275 |
[('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. |
276 |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
277 |
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. |
278 |
self.run_bzr_decode('push --verbose', encoding='ascii') |
279 |
||
280 |
self.run_bzr_decode(['push', '--verbose', dirname + '2']) |
|
281 |
||
282 |
self.run_bzr_decode(['push', '--verbose', dirname + '3'], |
|
283 |
encoding='ascii') |
|
284 |
||
285 |
self.run_bzr_decode(['push', '--verbose', '--create-prefix', |
|
286 |
dirname + '4/' + dirname + '5']) |
|
287 |
self.run_bzr_decode(['push', '--verbose', '--create-prefix', |
|
288 |
dirname + '6/' + dirname + '7'], encoding='ascii') |
|
1685.1.24
by John Arbash Meinel
cmd_push should use URLs throughout. |
289 |
|
1185.85.32
by John Arbash Meinel
Updated bzr renames |
290 |
def test_renames(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
291 |
fname = self.info['filename'] + '2' |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
292 |
self.wt.rename_one('a', fname) |
293 |
txt = self.run_bzr_decode('renames') |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
294 |
self.assertEqual(u'a => %s\n' % fname, txt) |
1185.85.32
by John Arbash Meinel
Updated bzr renames |
295 |
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
296 |
self.run_bzr_decode('renames', fail=True, encoding='ascii') |
1185.85.32
by John Arbash Meinel
Updated bzr renames |
297 |
|
1185.85.33
by John Arbash Meinel
Updated bzr remove, still remove --verbose still broken. |
298 |
def test_remove(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
299 |
fname = self.info['filename'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
300 |
txt = self.run_bzr_decode(['remove', fname], encoding='ascii') |
1185.85.33
by John Arbash Meinel
Updated bzr remove, still remove --verbose still broken. |
301 |
|
302 |
def test_remove_verbose(self): |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
303 |
fname = self.info['filename'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
304 |
txt = self.run_bzr_decode(['remove', '--verbose', fname], |
305 |
encoding='ascii') |
|
1185.85.33
by John Arbash Meinel
Updated bzr remove, still remove --verbose still broken. |
306 |
|
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. |
307 |
def test_file_id(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
308 |
fname = self.info['filename'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
309 |
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. |
310 |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
311 |
# TODO: jam 20060106 We don't support non-ascii file ids yet,
|
1185.85.35
by John Arbash Meinel
Updated file-path |
312 |
# so there is nothing which would fail in ascii encoding
|
313 |
# This *should* be retcode=3
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
314 |
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. |
315 |
|
1185.85.35
by John Arbash Meinel
Updated file-path |
316 |
def test_file_path(self): |
317 |
# Create a directory structure
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
318 |
fname = self.info['filename'] |
1185.85.72
by John Arbash Meinel
Fix some of the tests. |
319 |
dirname = self.info['directory'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
320 |
self.build_tree_contents([ |
321 |
('base/', ), |
|
322 |
(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. |
323 |
self.wt.add('base') |
324 |
self.wt.add('base/'+dirname) |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
325 |
path = osutils.pathjoin('base', dirname, fname) |
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
326 |
self.wt.rename_one(fname, path) |
327 |
self.wt.commit('moving things around') |
|
1185.85.35
by John Arbash Meinel
Updated file-path |
328 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
329 |
txt = self.run_bzr_decode(['file-path', path]) |
1185.85.35
by John Arbash Meinel
Updated file-path |
330 |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
331 |
# TODO: jam 20060106 We don't support non-ascii file ids yet,
|
1185.85.35
by John Arbash Meinel
Updated file-path |
332 |
# so there is nothing which would fail in ascii encoding
|
333 |
# This *should* be retcode=3
|
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
334 |
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. |
335 |
|
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
336 |
def test_revision_history(self): |
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
337 |
# 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 |
338 |
# 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. |
339 |
txt = self.run_bzr_decode('revision-history') |
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
340 |
|
341 |
def test_ancestry(self): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
342 |
# 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 |
343 |
# 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. |
344 |
txt = self.run_bzr_decode('ancestry') |
1185.85.36
by John Arbash Meinel
Working on tests for revision-history, ancestry, and diff |
345 |
|
346 |
def test_diff(self): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
347 |
# 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 |
348 |
# shouldn't encode the file contents, but it needs some sort
|
349 |
# 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. |
350 |
self.build_tree_contents([(self.info['filename'], 'newline\n')]) |
1685.1.78
by Wouter van Heyst
more code cleanup |
351 |
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. |
352 |
|
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
353 |
def test_deleted(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
354 |
fname = self.info['filename'] |
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
355 |
os.remove(fname) |
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
356 |
self.wt.remove(fname) |
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
357 |
|
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('deleted') |
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
359 |
self.assertEqual(fname+'\n', txt) |
360 |
||
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
361 |
txt = self.run_bzr_decode('deleted --show-ids') |
1185.85.49
by John Arbash Meinel
Updated cmd_deleted, including adding --show-ids option. |
362 |
self.failUnless(txt.startswith(fname)) |
363 |
||
1185.85.51
by John Arbash Meinel
Adding tests to make sure deleted and modified fail if cannot encode names. |
364 |
# Deleted should fail if cannot decode
|
365 |
# Because it is giving the exact paths
|
|
366 |
# which might be used by a front end
|
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
367 |
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. |
368 |
|
1185.85.50
by John Arbash Meinel
Updated cmd_modified |
369 |
def test_modified(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
370 |
fname = self.info['filename'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
371 |
self.build_tree_contents([(fname, 'modified\n')]) |
1185.85.50
by John Arbash Meinel
Updated cmd_modified |
372 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
373 |
txt = self.run_bzr_decode('modified') |
3251.6.3
by Adrian Wilkins
Simplified and fixed test code |
374 |
self.assertEqual('"'+fname+'"'+'\n', txt) |
1185.85.50
by John Arbash Meinel
Updated cmd_modified |
375 |
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
376 |
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. |
377 |
|
1185.85.52
by John Arbash Meinel
Updated cmd_added, which obviously had no tests, because it had a bug in it. |
378 |
def test_added(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
379 |
fname = self.info['filename'] + '2' |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
380 |
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. |
381 |
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. |
382 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
383 |
txt = self.run_bzr_decode('added') |
3251.6.3
by Adrian Wilkins
Simplified and fixed test code |
384 |
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. |
385 |
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
386 |
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. |
387 |
|
1185.85.53
by John Arbash Meinel
Updated cmd_root |
388 |
def test_root(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
389 |
dirname = self.info['directory'] |
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
390 |
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. |
391 |
self.run_bzr_decode('root') |
1185.85.53
by John Arbash Meinel
Updated cmd_root |
392 |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
393 |
self.wt.bzrdir.sprout(url) |
1185.85.53
by John Arbash Meinel
Updated cmd_root |
394 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
395 |
txt = self.run_bzr_decode('root', working_dir=dirname) |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
396 |
self.failUnless(txt.endswith(dirname+'\n')) |
1185.85.53
by John Arbash Meinel
Updated cmd_root |
397 |
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
398 |
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. |
399 |
working_dir=dirname) |
1185.85.53
by John Arbash Meinel
Updated cmd_root |
400 |
|
1185.85.54
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
401 |
def test_log(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
402 |
fname = self.info['filename'] |
403 |
||
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
404 |
txt = self.run_bzr_decode('log') |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
405 |
self.assertNotEqual(-1, txt.find(self.info['committer'])) |
406 |
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 |
407 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
408 |
txt = self.run_bzr_decode('log --verbose') |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
409 |
self.assertNotEqual(-1, txt.find(fname)) |
1185.85.54
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
410 |
|
411 |
# 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. |
412 |
txt = self.run_bzr_decode('log --verbose', encoding='ascii') |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
413 |
self.assertEqual(-1, txt.find(fname)) |
414 |
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 |
415 |
|
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
416 |
def test_touching_revisions(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
417 |
fname = self.info['filename'] |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
418 |
txt = self.run_bzr_decode(['touching-revisions', fname]) |
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
419 |
self.assertEqual(u' 3 added %s\n' % (fname,), txt) |
420 |
||
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
421 |
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. |
422 |
self.wt.rename_one(fname, fname2) |
423 |
self.wt.commit(u'Renamed %s => %s' % (fname, fname2)) |
|
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
424 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
425 |
txt = self.run_bzr_decode(['touching-revisions', fname2]) |
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
426 |
expected_txt = (u' 3 added %s\n' |
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
427 |
u' 4 renamed %s => %s\n' |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
428 |
% (fname, fname, fname2)) |
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
429 |
self.assertEqual(expected_txt, txt) |
430 |
||
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
431 |
self.run_bzr_decode(['touching-revisions', fname2], encoding='ascii', |
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
432 |
fail=True) |
1185.85.55
by John Arbash Meinel
Updated cmd_touching_revisions |
433 |
|
1185.85.56
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
434 |
def test_ls(self): |
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('ls') |
1830.3.10
by John Arbash Meinel
Don't compare direct output of ls, sort first |
436 |
self.assertEqual(sorted(['a', 'b', self.info['filename']]), |
437 |
sorted(txt.splitlines())) |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
438 |
txt = self.run_bzr_decode('ls --null') |
1830.3.10
by John Arbash Meinel
Don't compare direct output of ls, sort first |
439 |
self.assertEqual(sorted(['', 'a', 'b', self.info['filename']]), |
440 |
sorted(txt.split('\0'))) |
|
1185.85.56
by John Arbash Meinel
Keeping test_non_ascii in the same order as builtins.py |
441 |
|
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
442 |
txt = self.run_bzr_decode('ls', encoding='ascii', fail=True) |
443 |
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 |
444 |
|
1185.85.57
by John Arbash Meinel
Updated cmd_unknowns |
445 |
def test_unknowns(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
446 |
fname = self.info['filename'] + '2' |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
447 |
self.build_tree_contents([(fname, 'unknown\n')]) |
1185.85.57
by John Arbash Meinel
Updated cmd_unknowns |
448 |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
449 |
# TODO: jam 20060112 bzr unknowns is the only one which
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
450 |
# quotes paths do we really want it to?
|
3251.6.3
by Adrian Wilkins
Simplified and fixed test code |
451 |
# 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. |
452 |
txt = self.run_bzr_decode('unknowns') |
1185.85.57
by John Arbash Meinel
Updated cmd_unknowns |
453 |
self.assertEqual(u'"%s"\n' % (fname,), txt) |
454 |
||
2823.2.2
by Daniel Watkins
Merged bzr.dev. |
455 |
self.run_bzr_decode('unknowns', encoding='ascii', fail=True) |
1185.85.57
by John Arbash Meinel
Updated cmd_unknowns |
456 |
|
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
457 |
def test_ignore(self): |
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
458 |
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. |
459 |
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. |
460 |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
461 |
def check_unknowns(expected): |
462 |
self.assertEqual(expected, list(self.wt.unknowns())) |
|
463 |
||
464 |
check_unknowns([fname2]) |
|
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
465 |
|
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
466 |
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. |
467 |
check_unknowns([]) |
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
468 |
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
469 |
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. |
470 |
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. |
471 |
check_unknowns([fname3]) |
1185.85.58
by John Arbash Meinel
Working on bzr ignore, found that WorkingTree.is_ignored doesn't handle unicode names. |
472 |
|
473 |
# Ignore should not care what the encoding is
|
|
474 |
# (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. |
475 |
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. |
476 |
check_unknowns([]) |
1185.85.59
by John Arbash Meinel
Adding extra tests for future corrections to WorkingTree.is_ignored() |
477 |
|
478 |
# Now try a wildcard match
|
|
1185.85.70
by John Arbash Meinel
Hooked up EncodingAdapter, and updated test_non_ascii. |
479 |
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. |
480 |
self.build_tree_contents([(fname4, 'unknown 4\n')]) |
481 |
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. |
482 |
check_unknowns([]) |
1185.85.53
by John Arbash Meinel
Updated cmd_root |
483 |
|
1836.2.2
by John Arbash Meinel
Cleanup the rest of the test_non_ascii suite to use internal apis. |
484 |
# and a different wildcard that matches everything
|
1185.85.59
by John Arbash Meinel
Adding extra tests for future corrections to WorkingTree.is_ignored() |
485 |
os.remove('.bzrignore') |
2823.2.1
by Daniel Watkins
Cleaned up tests.blackbox.test_non_ascii so it uses internals where appropriate. |
486 |
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. |
487 |
check_unknowns([]) |
1185.85.59
by John Arbash Meinel
Adding extra tests for future corrections to WorkingTree.is_ignored() |
488 |
|
1816.1.1
by Alexander Belchenko
blackbox test for non-ascii behaviour of missing command |
489 |
def test_missing(self): |
490 |
# 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. |
491 |
self.make_branch_and_tree('empty-tree') |
1816.1.1
by Alexander Belchenko
blackbox test for non-ascii behaviour of missing command |
492 |
|
493 |
msg = self.info['message'] |
|
494 |
||
2823.2.3
by Daniel Watkins
Removed erroneous retcodes. |
495 |
txt = self.run_bzr_decode('missing empty-tree') |
1816.1.1
by Alexander Belchenko
blackbox test for non-ascii behaviour of missing command |
496 |
self.assertNotEqual(-1, txt.find(self.info['committer'])) |
497 |
self.assertNotEqual(-1, txt.find(msg)) |
|
498 |
||
499 |
# Make sure missing doesn't fail even if we can't write out
|
|
2823.2.3
by Daniel Watkins
Removed erroneous retcodes. |
500 |
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 |
501 |
self.assertEqual(-1, txt.find(msg)) |
502 |
self.assertNotEqual(-1, txt.find(msg.encode('ascii', 'replace'))) |
|
2904.3.1
by Lukáš Lalinský
Unicode-safe output from ``bzr info``. |
503 |
|
504 |
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. |
505 |
self.run_bzr_decode(['branch', u'.', self.info['directory']]) |
506 |
self.run_bzr_decode(['info', self.info['directory']]) |
|
507 |
self.run_bzr_decode(['info', self.info['directory']], |
|
508 |
encoding='ascii') |
|
3123.2.1
by Lukáš Lalinský
Use self.outf instead of sys.stdout in cmd_ignored. |
509 |
|
510 |
def test_ignored(self): |
|
511 |
fname = self.info['filename'] + '1.txt' |
|
512 |
self.build_tree_contents([(fname, 'ignored\n')]) |
|
513 |
self.run_bzr(['ignore', fname]) |
|
514 |
txt = self.run_bzr_decode(['ignored']) |
|
515 |
self.assertEqual(txt, '%-50s %s\n' % (fname, fname)) |
|
516 |
txt = self.run_bzr_decode(['ignored'], encoding='ascii') |
|
517 |
fname = fname.encode('ascii', 'replace') |
|
518 |
self.assertEqual(txt, '%-50s %s\n' % (fname, fname)) |