Merge lp:~jelmer/brz/python-bundle into lp:brz

Proposed by Jelmer Vernooij on 2018-08-14
Status: Merged
Approved by: Jelmer Vernooij on 2018-08-21
Approved revision: 7080
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/python-bundle
Merge into: lp:brz
Prerequisite: lp:~jelmer/brz/run-brz-bytes
Diff against target: 321 lines (+72/-33)
6 files modified
breezy/bundle/bundle_data.py (+1/-1)
breezy/bundle/serializer/v08.py (+1/-1)
breezy/tests/test_bundle.py (+14/-8)
breezy/tests/test_cache_utf8.py (+2/-2)
breezy/tests/test_selftest.py (+0/-17)
python3.passing (+54/-4)
To merge this branch: bzr merge lp:~jelmer/brz/python-bundle
Reviewer Review Type Date Requested Status
Martin Packman 2018-08-14 Approve on 2018-08-20
Review via email: mp+353123@code.launchpad.net

Commit message

Fix some bundle-related tests on Python 3.

Description of the change

Fix some bundle-related tests on Python 3.

To post a comment you must log in.
Martin Packman (gz) wrote :

Looks good, thanks!

review: Approve
The Breezy Bot (the-breezy-bot) wrote :

Running landing tests failed
https://ci.breezy-vcs.org/job/land-brz/420/

lp:~jelmer/brz/python-bundle updated on 2018-08-21
7080. By Jelmer Vernooij on 2018-08-21

Drop flapping tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/bundle/bundle_data.py'
2--- breezy/bundle/bundle_data.py 2018-07-19 23:46:16 +0000
3+++ breezy/bundle/bundle_data.py 2018-08-21 02:25:44 +0000
4@@ -350,7 +350,7 @@
5
6 def do_patch(path, lines, encoding):
7 if encoding == 'base64':
8- patch = base64.decodestring(b''.join(lines))
9+ patch = base64.b64decode(b''.join(lines))
10 elif encoding is None:
11 patch = b''.join(lines)
12 else:
13
14=== modified file 'breezy/bundle/serializer/v08.py'
15--- breezy/bundle/serializer/v08.py 2018-07-19 23:46:16 +0000
16+++ breezy/bundle/serializer/v08.py 2018-08-21 02:25:44 +0000
17@@ -316,7 +316,7 @@
18 action = Action('removed', [kind, path]).write(self.to_file)
19
20 for path, file_id, kind in delta.added:
21- action = Action('added', [kind, path], [('file-id', file_id)])
22+ action = Action('added', [kind, path], [('file-id', file_id.decode('utf-8'))])
23 meta_modified = (kind=='file' and
24 new_tree.is_executable(path, file_id))
25 finish_action(action, file_id, kind, meta_modified, True,
26
27=== modified file 'breezy/tests/test_bundle.py'
28--- breezy/tests/test_bundle.py 2018-08-04 17:17:45 +0000
29+++ breezy/tests/test_bundle.py 2018-08-21 02:25:44 +0000
30@@ -124,6 +124,8 @@
31 def make_entry(self, file_id, path):
32 from ..bzr.inventory import (InventoryFile, InventoryDirectory,
33 InventoryLink)
34+ if not isinstance(file_id, bytes):
35+ raise TypeError(file_id)
36 name = os.path.basename(path)
37 kind = self.kind(path, file_id)
38 parent_id = self.parent_id(file_id)
39@@ -141,10 +143,14 @@
40 return ie
41
42 def add_dir(self, file_id, path):
43+ if not isinstance(file_id, bytes):
44+ raise TypeError(file_id)
45 self.paths[file_id] = path
46 self.ids[path] = file_id
47
48 def add_file(self, file_id, path, contents):
49+ if not isinstance(file_id, bytes):
50+ raise TypeError(file_id)
51 self.add_dir(file_id, path)
52 self.contents[file_id] = contents
53
54@@ -316,7 +322,7 @@
55
56 def make_tree_3(self):
57 btree, mtree = self.make_tree_1()
58- mtree.add_file("e", "grandparent/parent/topping", "Anchovies\n")
59+ mtree.add_file(b"e", "grandparent/parent/topping", b"Anchovies\n")
60 btree.note_rename("grandparent/parent/file",
61 "grandparent/alt_parent/file")
62 btree.note_rename("grandparent/parent/topping",
63@@ -480,8 +486,8 @@
64 :return: The in-memory bundle
65 """
66 bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id)
67- new_text = bundle_txt.getvalue().replace('executable:no',
68- 'executable:yes')
69+ new_text = bundle_txt.getvalue().replace(b'executable:no',
70+ b'executable:yes')
71 bundle_txt = BytesIO(new_text)
72 bundle = read_bundle(bundle_txt)
73 self.valid_apply_bundle(base_rev_id, bundle)
74@@ -1778,7 +1784,7 @@
75 writer = v4.BundleWriter(fileobj)
76 writer.begin()
77 writer.add_info_record({b'foo': b'bar'})
78- writer._add_record("Record body", {b'parents': [b'1', b'3'],
79+ writer._add_record(b"Record body", {b'parents': [b'1', b'3'],
80 b'storage_kind': b'fulltext'}, 'file', b'revid', b'fileid')
81 writer.end()
82 fileobj.seek(0)
83@@ -1788,7 +1794,7 @@
84 self.assertEqual((None, {b'foo': b'bar', b'storage_kind': b'header'},
85 'info', None, None), record)
86 record = next(record_iter)
87- self.assertEqual(("Record body", {b'storage_kind': b'fulltext',
88+ self.assertEqual((b"Record body", {b'storage_kind': b'fulltext',
89 b'parents': [b'1', b'3']}, 'file', b'revid', b'fileid'),
90 record)
91
92@@ -1797,7 +1803,7 @@
93 writer = v4.BundleWriter(fileobj)
94 writer.begin()
95 writer.add_info_record({b'foo': b'bar'})
96- writer._add_record("Record body", {b'parents': [b'1', b'3'],
97+ writer._add_record(b"Record body", {b'parents': [b'1', b'3'],
98 b'storage_kind': b'fulltext'}, 'file', b'revid', b'fileid')
99 writer.end()
100 fileobj.seek(0)
101@@ -1807,7 +1813,7 @@
102 self.assertEqual((None, {b'foo': b'bar', b'storage_kind': b'header'},
103 'info', None, None), record)
104 record = next(record_iter)
105- self.assertEqual(("Record body", {b'storage_kind': b'fulltext',
106+ self.assertEqual((b"Record body", {b'storage_kind': b'fulltext',
107 b'parents': [b'1', b'3']}, 'file', b'revid', b'fileid'),
108 record)
109
110@@ -1832,7 +1838,7 @@
111 writer = v4.BundleWriter(fileobj)
112 writer.begin()
113 writer.add_info_record({b'foo': b'bar'})
114- writer._container.add_bytes_record(b'blah', [b'two', b'names'])
115+ writer._container.add_bytes_record(b'blah', [(b'two', ), (b'names', )])
116 writer.end()
117 fileobj.seek(0)
118 record_iter = v4.BundleReader(fileobj).iter_records()
119
120=== modified file 'breezy/tests/test_cache_utf8.py'
121--- breezy/tests/test_cache_utf8.py 2018-06-16 11:29:34 +0000
122+++ breezy/tests/test_cache_utf8.py 2018-08-21 02:25:44 +0000
123@@ -113,6 +113,6 @@
124
125 def test_decode_with_None(self):
126 self.assertEqual(None, cache_utf8._utf8_decode_with_None(None))
127- self.assertEqual(u'foo', cache_utf8._utf8_decode_with_None('foo'))
128+ self.assertEqual(u'foo', cache_utf8._utf8_decode_with_None(b'foo'))
129 self.assertEqual(u'f\xb5',
130- cache_utf8._utf8_decode_with_None('f\xc2\xb5'))
131+ cache_utf8._utf8_decode_with_None(b'f\xc2\xb5'))
132
133=== modified file 'breezy/tests/test_selftest.py'
134--- breezy/tests/test_selftest.py 2018-08-21 02:25:44 +0000
135+++ breezy/tests/test_selftest.py 2018-08-21 02:25:44 +0000
136@@ -2239,15 +2239,9 @@
137
138 def test_skip_has_no_log(self):
139 content, result = self.run_subunit_stream('test_skip')
140-<<<<<<< TREE
141 self.assertNotContainsRe(content, b'(?m)^log$')
142 self.assertNotContainsRe(content, b'this test will be skipped')
143- reasons = _get_skip_reasons(result)
144-=======
145- self.assertNotContainsRe(content, '(?m)^log$')
146- self.assertNotContainsRe(content, 'this test will be skipped')
147 reasons = result.skip_reasons
148->>>>>>> MERGE-SOURCE
149 self.assertEqual({'reason'}, set(reasons))
150 skips = reasons['reason']
151 self.assertEqual(1, len(skips))
152@@ -2257,15 +2251,9 @@
153
154 def test_missing_feature_has_no_log(self):
155 content, result = self.run_subunit_stream('test_missing_feature')
156-<<<<<<< TREE
157 self.assertNotContainsRe(content, b'(?m)^log$')
158 self.assertNotContainsRe(content, b'missing the feature')
159- reasons = _get_skip_reasons(result)
160-=======
161- self.assertNotContainsRe(content, '(?m)^log$')
162- self.assertNotContainsRe(content, 'missing the feature')
163 reasons = result.skip_reasons
164->>>>>>> MERGE-SOURCE
165 self.assertEqual({'_MissingFeature\n'}, set(reasons))
166 skips = reasons['_MissingFeature\n']
167 self.assertEqual(1, len(skips))
168@@ -2285,13 +2273,8 @@
169
170 def test_unexpected_success_has_log(self):
171 content, result = self.run_subunit_stream('test_unexpected_success')
172-<<<<<<< TREE
173 self.assertContainsRe(content, b'(?m)^log$')
174 self.assertContainsRe(content, b'test with unexpected success')
175-=======
176- self.assertContainsRe(content, '(?m)^log$')
177- self.assertContainsRe(content, 'test with unexpected success')
178->>>>>>> MERGE-SOURCE
179 self.assertEqual(1, len(result.unexpectedSuccesses))
180 test = result.unexpectedSuccesses[0]
181 # RemotedTestCase doesn't preserve the "details"
182
183=== modified file 'python3.passing'
184--- python3.passing 2018-08-21 02:25:44 +0000
185+++ python3.passing 2018-08-21 02:25:44 +0000
186@@ -1,8 +1,5 @@
187 # This is the list of tests that are known to pass with Python3.
188 # "make check-nodocs3" verifies that these pass.
189-<<<<<<< TREE
190-breezy.git.tests.test_builder.TestGitBranchBuilder.test_set_file_unicode
191-=======
192 breezy.git.tests.test_blackbox.ShallowTests.test_log_shallow
193 breezy.git.tests.test_blackbox.ShallowTests.test_version_info_custom_without_revno
194 breezy.git.tests.test_blackbox.ShallowTests.test_version_info_custom_with_revno
195@@ -318,7 +315,6 @@
196 breezy.git.tests.test_workingtree.GitWorkingTreeTests.test_revert_empty
197 breezy.git.tests.test_workingtree.TreeDeltaFromGitChangesTests.test_empty
198 breezy.git.tests.test_workingtree.TreeDeltaFromGitChangesTests.test_missing
199->>>>>>> MERGE-SOURCE
200 breezy.plugins.bash_completion.tests.test_bashcomp.BlackboxTests.test_bash_completion
201 breezy.plugins.bash_completion.tests.test_bashcomp.TestBashCodeGen.test_brz_version
202 breezy.plugins.bash_completion.tests.test_bashcomp.TestBashCodeGen.test_command_case
203@@ -22828,11 +22824,14 @@
204 breezy.tests.test_bundle.BTreeTester.test_adds
205 breezy.tests.test_bundle.BTreeTester.test_adds2
206 breezy.tests.test_bundle.BTreeTester.test_delete
207+breezy.tests.test_bundle.BTreeTester.test_get_file
208+breezy.tests.test_bundle.BTreeTester.test_get_file2
209 breezy.tests.test_bundle.BTreeTester.test_iteration
210 breezy.tests.test_bundle.BTreeTester.test_moves
211 breezy.tests.test_bundle.BTreeTester.test_renames
212 breezy.tests.test_bundle.BundleTester1.test_matched_bundle
213 breezy.tests.test_bundle.BundleTester1.test_mismatched_bundle
214+breezy.tests.test_bundle.BundleTester1.test_mismatched_model
215 breezy.tests.test_bundle.MungedBundleTesterV09.test_extra_whitespace
216 breezy.tests.test_bundle.MungedBundleTesterV09.test_extra_whitespace_2
217 breezy.tests.test_bundle.MungedBundleTesterV09.test_missing_trailing_whitespace
218@@ -22842,45 +22841,95 @@
219 breezy.tests.test_bundle.MungedBundleTesterV4.test_extra_whitespace_2
220 breezy.tests.test_bundle.TestBundleWriterReader.test_decode_name
221 breezy.tests.test_bundle.TestBundleWriterReader.test_encode_name
222+breezy.tests.test_bundle.TestBundleWriterReader.test_roundtrip_record
223+breezy.tests.test_bundle.TestBundleWriterReader.test_roundtrip_record_memory_hungry
224+breezy.tests.test_bundle.TestBundleWriterReader.test_too_many_names
225 breezy.tests.test_bundle.TestReadMergeableFromUrl.test_infinite_redirects_are_not_a_bundle
226 breezy.tests.test_bundle.TestReadMergeableFromUrl.test_read_mergeable_skips_local
227 breezy.tests.test_bundle.TestReadMergeableFromUrl.test_smart_server_connection_reset
228+breezy.tests.test_bundle.V08BundleTester.test_across_models
229 breezy.tests.test_bundle.V08BundleTester.test_across_models_incompatible
230+breezy.tests.test_bundle.V08BundleTester.test_across_serializers
231+breezy.tests.test_bundle.V08BundleTester.test_alt_timezone_bundle
232+breezy.tests.test_bundle.V08BundleTester.test_binary_bundle
233+breezy.tests.test_bundle.V08BundleTester.test_bundle
234 breezy.tests.test_bundle.V08BundleTester.test_bundle_empty_property
235 breezy.tests.test_bundle.V08BundleTester.test_bundle_empty_property_alt
236 breezy.tests.test_bundle.V08BundleTester.test_bundle_root_id
237 breezy.tests.test_bundle.V08BundleTester.test_bundle_same_basis
238 breezy.tests.test_bundle.V08BundleTester.test_bundle_sorted_properties
239 breezy.tests.test_bundle.V08BundleTester.test_bundle_unicode_properties
240+breezy.tests.test_bundle.V08BundleTester.test_bundle_with_ghosts
241 breezy.tests.test_bundle.V08BundleTester.test_crlf_bundle
242 breezy.tests.test_bundle.V08BundleTester.test_get_merge_request
243 breezy.tests.test_bundle.V08BundleTester.test_hide_history
244 breezy.tests.test_bundle.V08BundleTester.test_install_revisions
245+breezy.tests.test_bundle.V08BundleTester.test_inv_hash_across_serializers
246+breezy.tests.test_bundle.V08BundleTester.test_last_modified
247 breezy.tests.test_bundle.V08BundleTester.test_malformed
248 breezy.tests.test_bundle.V08BundleTester.test_non_bundle
249 breezy.tests.test_bundle.V08BundleTester.test_revision_id_with_slash
250+breezy.tests.test_bundle.V08BundleTester.test_skip_file
251+breezy.tests.test_bundle.V08BundleTester.test_symlink_bundle
252+breezy.tests.test_bundle.V08BundleTester.test_unicode_bundle
253+breezy.tests.test_bundle.V08BundleTester.test_unicode_symlink_bundle
254+breezy.tests.test_bundle.V08BundleTester.test_whitespace_bundle
255 breezy.tests.test_bundle.V08BundleTester.test_with_subtree
256+breezy.tests.test_bundle.V09BundleKnit1Tester.test_across_models
257+breezy.tests.test_bundle.V09BundleKnit1Tester.test_across_models_incompatible
258+breezy.tests.test_bundle.V09BundleKnit1Tester.test_across_serializers
259+breezy.tests.test_bundle.V09BundleKnit1Tester.test_alt_timezone_bundle
260+breezy.tests.test_bundle.V09BundleKnit1Tester.test_binary_bundle
261+breezy.tests.test_bundle.V09BundleKnit1Tester.test_bundle
262 breezy.tests.test_bundle.V09BundleKnit1Tester.test_bundle_empty_property
263 breezy.tests.test_bundle.V09BundleKnit1Tester.test_bundle_empty_property_alt
264+breezy.tests.test_bundle.V09BundleKnit1Tester.test_bundle_root_id
265 breezy.tests.test_bundle.V09BundleKnit1Tester.test_bundle_same_basis
266 breezy.tests.test_bundle.V09BundleKnit1Tester.test_bundle_sorted_properties
267 breezy.tests.test_bundle.V09BundleKnit1Tester.test_bundle_unicode_properties
268+breezy.tests.test_bundle.V09BundleKnit1Tester.test_bundle_with_ghosts
269 breezy.tests.test_bundle.V09BundleKnit1Tester.test_crlf_bundle
270 breezy.tests.test_bundle.V09BundleKnit1Tester.test_get_merge_request
271 breezy.tests.test_bundle.V09BundleKnit1Tester.test_hide_history
272+breezy.tests.test_bundle.V09BundleKnit1Tester.test_install_revisions
273+breezy.tests.test_bundle.V09BundleKnit1Tester.test_inv_hash_across_serializers
274+breezy.tests.test_bundle.V09BundleKnit1Tester.test_last_modified
275 breezy.tests.test_bundle.V09BundleKnit1Tester.test_malformed
276 breezy.tests.test_bundle.V09BundleKnit1Tester.test_non_bundle
277+breezy.tests.test_bundle.V09BundleKnit1Tester.test_revision_id_with_slash
278+breezy.tests.test_bundle.V09BundleKnit1Tester.test_skip_file
279+breezy.tests.test_bundle.V09BundleKnit1Tester.test_symlink_bundle
280+breezy.tests.test_bundle.V09BundleKnit1Tester.test_unicode_bundle
281+breezy.tests.test_bundle.V09BundleKnit1Tester.test_unicode_symlink_bundle
282+breezy.tests.test_bundle.V09BundleKnit1Tester.test_whitespace_bundle
283 breezy.tests.test_bundle.V09BundleKnit1Tester.test_with_subtree
284+breezy.tests.test_bundle.V09BundleKnit2Tester.test_across_models
285+breezy.tests.test_bundle.V09BundleKnit2Tester.test_across_models_incompatible
286+breezy.tests.test_bundle.V09BundleKnit2Tester.test_across_serializers
287+breezy.tests.test_bundle.V09BundleKnit2Tester.test_alt_timezone_bundle
288+breezy.tests.test_bundle.V09BundleKnit2Tester.test_binary_bundle
289+breezy.tests.test_bundle.V09BundleKnit2Tester.test_bundle
290 breezy.tests.test_bundle.V09BundleKnit2Tester.test_bundle_empty_property
291 breezy.tests.test_bundle.V09BundleKnit2Tester.test_bundle_empty_property_alt
292+breezy.tests.test_bundle.V09BundleKnit2Tester.test_bundle_root_id
293 breezy.tests.test_bundle.V09BundleKnit2Tester.test_bundle_same_basis
294 breezy.tests.test_bundle.V09BundleKnit2Tester.test_bundle_sorted_properties
295 breezy.tests.test_bundle.V09BundleKnit2Tester.test_bundle_unicode_properties
296+breezy.tests.test_bundle.V09BundleKnit2Tester.test_bundle_with_ghosts
297 breezy.tests.test_bundle.V09BundleKnit2Tester.test_crlf_bundle
298 breezy.tests.test_bundle.V09BundleKnit2Tester.test_get_merge_request
299 breezy.tests.test_bundle.V09BundleKnit2Tester.test_hide_history
300+breezy.tests.test_bundle.V09BundleKnit2Tester.test_install_revisions
301+breezy.tests.test_bundle.V09BundleKnit2Tester.test_inv_hash_across_serializers
302+breezy.tests.test_bundle.V09BundleKnit2Tester.test_last_modified
303 breezy.tests.test_bundle.V09BundleKnit2Tester.test_malformed
304 breezy.tests.test_bundle.V09BundleKnit2Tester.test_non_bundle
305+breezy.tests.test_bundle.V09BundleKnit2Tester.test_revision_id_with_slash
306+breezy.tests.test_bundle.V09BundleKnit2Tester.test_skip_file
307+breezy.tests.test_bundle.V09BundleKnit2Tester.test_symlink_bundle
308+breezy.tests.test_bundle.V09BundleKnit2Tester.test_unicode_bundle
309+breezy.tests.test_bundle.V09BundleKnit2Tester.test_unicode_symlink_bundle
310+breezy.tests.test_bundle.V09BundleKnit2Tester.test_whitespace_bundle
311 breezy.tests.test_bundle.V09BundleKnit2Tester.test_with_subtree
312 breezy.tests.test_bundle.V4_2aBundleTester.test_across_models
313 breezy.tests.test_bundle.V4_2aBundleTester.test_across_models_incompatible
314@@ -23054,6 +23103,7 @@
315 breezy.tests.test_cache_utf8.TestEncodeCache.test_ascii
316 breezy.tests.test_cache_utf8.TestEncodeCache.test_cached_unicode
317 breezy.tests.test_cache_utf8.TestEncodeCache.test_cached_utf8
318+breezy.tests.test_cache_utf8.TestEncodeCache.test_decode_with_None
319 breezy.tests.test_cache_utf8.TestEncodeCache.test_unicode
320 breezy.tests.test_cethread.TestCatchingExceptionThread.test_exception_is_re_raised
321 breezy.tests.test_cethread.TestCatchingExceptionThread.test_exception_while_switch_and_set

Subscribers

People subscribed via source and target branches