Merge lp:~allenap/launchpad/zope-test-in-subprocess-unicode-issue into lp:launchpad

Proposed by Gavin Panella on 2010-11-25
Status: Merged
Approved by: Jonathan Lange on 2010-11-25
Approved revision: no longer in the source branch.
Merged at revision: 11983
Proposed branch: lp:~allenap/launchpad/zope-test-in-subprocess-unicode-issue
Merge into: lp:launchpad
Diff against target: 19 lines (+2/-1)
1 file modified
lib/lp/testing/__init__.py (+2/-1)
To merge this branch: bzr merge lp:~allenap/launchpad/zope-test-in-subprocess-unicode-issue
Reviewer Review Type Date Requested Status
Jonathan Lange (community) 2010-11-25 Approve on 2010-11-25
Review via email: mp+41886@code.launchpad.net

Commit Message

[testfix][r=jml][ui=none][no-qa] Pass a UTF8 decoded stream reader to subunit.TestProtocolServer.readFrom().

Description of the Change

Pass a decoded stream reader to subunit.TestProtocolServer. See the thread containing https://lists.launchpad.net/launchpad-dev/msg05732.html for more information.

To post a comment you must log in.
Jonathan Lange (jml) wrote :

Looks good. Maybe a good idea to run a test subclass of ZTIS before submitting.

review: Approve
Robert Collins (lifeless) wrote :

Uhm, this is probably a terrible idea. subunit is a byte protocol,
throwing unicode at it you should expect to keep both pieces.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/testing/__init__.py'
2--- lib/lp/testing/__init__.py 2010-11-25 14:15:30 +0000
3+++ lib/lp/testing/__init__.py 2010-11-25 16:58:55 +0000
4@@ -46,6 +46,7 @@
5 'ZopeTestInSubProcess',
6 ]
7
8+import codecs
9 from contextlib import contextmanager
10 from datetime import (
11 datetime,
12@@ -864,7 +865,7 @@
13 result = super(ZopeTestResult, result)
14 # Accept the result from the child process.
15 protocol = subunit.TestProtocolServer(result)
16- protocol.readFrom(fdread)
17+ protocol.readFrom(codecs.getreader("utf8")(fdread))
18 fdread.close()
19 os.waitpid(pid, 0)
20