Merge lp:~jelmer/brz/fix-child-fork-test into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/fix-child-fork-test
Merge into: lp:brz
Diff against target: 43 lines (+7/-2)
3 files modified
breezy/tests/__init__.py (+5/-1)
breezy/tests/test_selftest.py (+1/-1)
python3.passing (+1/-0)
To merge this branch: bzr merge lp:~jelmer/brz/fix-child-fork-test
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+353754@code.launchpad.net

Commit message

On Python 3, fix testing of passthrough output when selftest fork child fails.

Description of the change

Fix testing of passthrough output when selftest fork child fails.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

I'm not sure on this one. We can't actually safely encode the result of format_exc() as utf-8 on Python 2 - it only works if the traceback is ascii only.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Updated to only encode if the traceback is of type text_type.

Revision history for this message
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/__init__.py'
2--- breezy/tests/__init__.py 2018-08-13 01:38:21 +0000
3+++ breezy/tests/__init__.py 2018-09-02 21:04:40 +0000
4@@ -3604,9 +3604,13 @@
5 # if stream couldn't be created or something else goes wrong.
6 # The traceback is formatted to a string and written in one go
7 # to avoid interleaving lines from multiple failing children.
8+ tb = traceback.format_exc()
9+ if isinstance(tb, text_type):
10+ tb = tb.encode('utf-8')
11 try:
12- stream.write(traceback.format_exc())
13+ stream.write(tb)
14 finally:
15+ stream.flush()
16 os._exit(1)
17 os._exit(0)
18 else:
19
20=== modified file 'breezy/tests/test_selftest.py'
21--- breezy/tests/test_selftest.py 2018-08-21 02:25:27 +0000
22+++ breezy/tests/test_selftest.py 2018-09-02 21:04:40 +0000
23@@ -3383,7 +3383,7 @@
24 sio = TextIOWrapper(bio, 'utf-8')
25 else:
26 sio = bio = StringIO()
27- self._inject_stream_into_subunit(sio)
28+ self._inject_stream_into_subunit(bio)
29 tests.selftest(stream=sio, stop_on_failure=False, **kwargs)
30 sio.flush()
31 return bio.getvalue()
32
33=== modified file 'python3.passing'
34--- python3.passing 2018-09-01 21:51:32 +0000
35+++ python3.passing 2018-09-02 21:04:40 +0000
36@@ -28807,6 +28807,7 @@
37 breezy.tests.test_selftest.TestLoadTestIdList.test_load_dirty_file
38 breezy.tests.test_selftest.TestLoadTestIdList.test_load_test_list
39 breezy.tests.test_selftest.TestLoadTestIdList.test_load_unknown
40+breezy.tests.test_selftest.TestParallelFork.test_error_in_child_during_fork
41 breezy.tests.test_selftest.TestPostMortemDebugging.test_env_var_triggers_post_mortem
42 breezy.tests.test_selftest.TestPostMortemDebugging.test_location_bt_error
43 breezy.tests.test_selftest.TestPostMortemDebugging.test_location_bt_failure

Subscribers

People subscribed via source and target branches