Merge lp:~bac/zope.testing/1012171 into lp:~launchpad/zope.testing/3.9.4-fork
| Status: | Merged |
|---|---|
| Approved by: | Brad Crittenden on 2012-06-19 |
| Approved revision: | 43 |
| Merged at revision: | 41 |
| Proposed branch: | lp:~bac/zope.testing/1012171 |
| Merge into: | lp:~launchpad/zope.testing/3.9.4-fork |
| Diff against target: |
257 lines (+129/-9) 5 files modified
.bzrignore (+1/-0) setup.py (+1/-1) src/zope/testing/testrunner/formatter.py (+30/-2) src/zope/testing/testrunner/options.py (+4/-2) src/zope/testing/testrunner/test_subunit.py (+93/-4) |
| To merge this branch: | bzr merge lp:~bac/zope.testing/1012171 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Benji York (community) | code | 2012-06-19 | Approve on 2012-06-19 |
|
Review via email:
|
|||
Commit Message
Include data written to stdout or stderr by tests into the subunit output stream.
Description of the Change
Include data written to stdout or stderr by tests into the subunit output stream.
Test:
bin/test -vvt test_subunit
| Robert Collins (lifeless) wrote : | # |
This:
+ if msg:
+ details['STDOUT:'] = content.Content(
+ self.PLAIN_TEXT, partial(lambda x: x, msg))
Would be simpler as:
if msg:
details[
(assuming msg is a unicode object, not a bytestring). If msg is a
bytestring, then:
if msg:
details[
would be appropriate.
As it is, you're generating content objects that iterate bytes of
length 1, which will be pathologically slow, so you should change this
one way or another. Happy to chat on IRC or wherever if you need more
pointers.
-Rob
| Gavin Panella (allenap) wrote : | # |
On 19 June 2012 21:46, Robert Collins <email address hidden> wrote:
...
> (assuming msg is a unicode object, not a bytestring). If msg is a
> bytestring, then:
> if msg:
> details['STDOUT:'] = content.
This will keep a reference to msg in the enclosing scope. A quick look
at the code shows that msg is changed later in the function, so this
will break, hence the need for the partial() I think.
| Robert Collins (lifeless) wrote : | # |
On Wed, Jun 20, 2012 at 10:28 AM, Gavin Panella
<email address hidden> wrote:
> On 19 June 2012 21:46, Robert Collins <email address hidden> wrote:
> ...
>> (assuming msg is a unicode object, not a bytestring). If msg is a
>> bytestring, then:
>> if msg:
>> details['STDOUT:'] = content.
>
> This will keep a reference to msg in the enclosing scope. A quick look
> at the code shows that msg is changed later in the function, so this
> will break, hence the need for the partial() I think.
Oh! So, I'd wrap the two lines in a helper, that will break the
scoping problem and be shorter overall:
def attach(label, msg):
if msg:
attach('STDOUT:, _get_new_
attach('STDERR:, _get_new_
5 lines vs 6, and less partial gymnastics ;)
-Rob


This looks great.
I'm disappointed in the hoops you had to jump through to build the content.Content objects.