Merge lp://staging/~jml/subunit/filter-tags into lp://staging/~subunit/subunit/trunk

Proposed by Jonathan Lange
Status: Merged
Merged at revision: 165
Proposed branch: lp://staging/~jml/subunit/filter-tags
Merge into: lp://staging/~subunit/subunit/trunk
Prerequisite: lp://staging/~jml/subunit/tag-collapsing-rigor
Diff against target: 798 lines (+431/-201)
3 files modified
filters/subunit-filter (+89/-59)
python/subunit/test_results.py (+209/-140)
python/subunit/tests/test_subunit_filter.py (+133/-2)
To merge this branch: bzr merge lp://staging/~jml/subunit/filter-tags
Reviewer Review Type Date Requested Status
Robert Collins Needs Fixing
Review via email: mp+102840@code.staging.launchpad.net

Commit message

Add options to filter streams by tags.

Description of the change

This branch adds options to subunit-filter to have it filter by tags. It has three main components:

1. Separating out a _PredicateFilter from TestResultFilter.

This simplifies TestResultFilter, leaving it managing two concerns: assembling options into a predicate and transforming results. It will be much easier to separate out the 'transforming results' concern after this change.

It is likely that _PredicateFilter could also be written in terms of TestByTestResult at some point.

2. Extending the predicate function to take 'tags'.

I've tried to do this in a way that preserves backwards compatibility and allows any users of TestResultFilter who've had a predicate function that does not support tags to continue using their code unchanged. Perhaps this is not needed.

3. Cleaning up subunit-filter

It behaves a little differently to the other filter commands, and has a different set of options, but these cleanups share code where we can and make the differences -- I hope -- more obvious.

None of this works without the fixes to TagCollapsingDecorator.

jml

To post a comment you must log in.
185. By Jonathan Lange

Factor a TagsMixin out of TagCollapsingDecorator

186. By Jonathan Lange

Use the TagsMixin on the predicate so local and global tags are tracked correctly.

Revision history for this message
Robert Collins (lifeless) wrote :

I don't get
353 + # XXX: ExtendedToOriginalDecorator doesn't properly wrap current_tags.
354 + # https://bugs.launchpad.net/testtools/+bug/978027

review: Needs Information
Revision history for this message
Jonathan Lange (jml) wrote :

On 26 April 2012 03:07, Robert Collins <email address hidden> wrote:
> Review: Needs Information
>
> I don't get
> 353     + # XXX: ExtendedToOriginalDecorator doesn't properly wrap current_tags.
> 354     + # https://bugs.launchpad.net/testtools/+bug/978027
>

Detritus from an earlier version. Have removed it.

jml

187. By Jonathan Lange

Merge trunk

188. By Jonathan Lange

Fix up some XXX comments.

Revision history for this message
Robert Collins (lifeless) wrote :

I merged this to a worktree tree of trunk. There was a trivial conflict (mis-bound hunks in test_results.py), but tests failed:

======================================================================
FAIL: test_time_ordering_preserved (subunit.tests.test_subunit_filter.TestTestResultFilter)
subunit.tests.test_subunit_filter.TestTestResultFilter.test_time_ordering_preserved
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/robertc/source/unittest/subunit/working/python/subunit/tests/test_subunit_filter.py", line 240, in test_time_ordering_preserved
    ('time', date_c)], result._events)
AssertionError: Sequences differ: [('time', datetime.datetime(20... != [('time', datetime.datetime(20...

First differing element 1:
('time', datetime.datetime(2000, 1, 2, 0, 0, tzinfo=<subunit.iso8601.Utc object at 0x194af10>))
('startTest', <subunit.RemotedTestCase description='foo'>)

+ [('time', datetime.datetime(2000, 1, 1, 0, 0, tzinfo=<FixedOffset '+00:00'>)),
- [('time',
- datetime.datetime(2000, 1, 1, 0, 0, tzinfo=<subunit.iso8601.Utc object at 0x194af10>)),
- ('time',
- datetime.datetime(2000, 1, 2, 0, 0, tzinfo=<subunit.iso8601.Utc object at 0x194af10>)),
   ('startTest', <subunit.RemotedTestCase description='foo'>),
+ ('time', datetime.datetime(2000, 1, 2, 0, 0, tzinfo=<FixedOffset '+00:00'>)),
   ('addError', <subunit.RemotedTestCase description='foo'>, {}),
   ('stopTest', <subunit.RemotedTestCase description='foo'>),
+ ('time', datetime.datetime(2000, 1, 3, 0, 0, tzinfo=<FixedOffset '+00:00'>))]
- ('time',
- datetime.datetime(2000, 1, 3, 0, 0, tzinfo=<subunit.iso8601.Utc object at 0x194af10>))]

review: Needs Fixing
Revision history for this message
Robert Collins (lifeless) wrote :

The TestResultFilter :predicate: parameter docs need updating too:

        :param filter_predicate: A callable taking (test, outcome, err,
            details, tags) and returning True if the result should be passed
            through. err and details may be none if no error or extra
            metadata is available. outcome is the name of the outcome such
            as 'success' or 'failure'. tags is new in 0.0.8; 0.0.7 filters
            are still supported but should be updated to accept the tags
            parameter for efficiency.

Revision history for this message
Robert Collins (lifeless) wrote :

The FixedOffset class is also coming from iso8601.py.

Revision history for this message
Robert Collins (lifeless) wrote :

Ah, redundant time statement dropped.

Revision history for this message
Robert Collins (lifeless) wrote :

(where by dropped I mean 'I am tired and it moved').

Revision history for this message
Jonathan Lange (jml) wrote :

Thanks for landing this.

> "The FixedOffset class is also coming from iso8601.py."

I don't know what this means or is in relation to. Mentioned on IRC, but putting here as it's better suited to async comms.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches