On Thu, Aug 6, 2009 at 10:10 AM, Robert
Collins<email address hidden> wrote:
> Robert Collins has proposed merging lp:~lifeless/subunit/xfail into lp:subunit.
>
> Requested reviews:
> Subunit Developers (subunit)
>
> make xfail use addExpectedFailure
Hey Rob,
Only a few comments here.
> === modified file 'NEWS'
> --- NEWS 2009-08-02 22:55:36 +0000
> +++ NEWS 2009-08-06 08:48:01 +0000
> @@ -32,6 +32,11 @@
>
> BUG FIXES:
>
> + * ``xfail`` outcomes are now passed to python TestResult's via
> + addExpectedFailure if it is present on the TestResult. Python 2.6 and
> + earlier which do not have this function will have ``xfail`` outcomes
> + passed through as success outcomes as earlier versions of subunit did.
> +
> API CHANGES:
>
> * When a progress: directive is encountered in a subunit stream, the
>
> === modified file 'python/subunit/__init__.py'
> --- python/subunit/__init__.py 2009-08-02 22:55:36 +0000
> +++ python/subunit/__init__.py 2009-08-06 08:48:01 +0000
> @@ -120,7 +120,11 @@
> self.current_test_description == line[offset:-1]):
> self.state = TestProtocolServer.OUTSIDE_TEST
> self.current_test_description = None
> - self.client.addSuccess(self._current_test)
> + xfail = getattr(self.client, 'addExpectedFailure', None)
> + if callable(xfail):
Is there a way to avoid using 'callable' here? It's a little look before you
leap, and is not present in Python 3.
One way to do it would be to call it if not None, and catch a TypeError.
On Thu, Aug 6, 2009 at 10:10 AM, Robert
Collins<email address hidden> wrote:
> Robert Collins has proposed merging lp:~lifeless/subunit/xfail into lp:subunit.
>
> Requested reviews:
> Subunit Developers (subunit)
>
> make xfail use addExpectedFailure
Hey Rob,
Only a few comments here.
> === modified file 'NEWS' subunit/ __init_ _.py' subunit/ __init_ _.py 2009-08-02 22:55:36 +0000 subunit/ __init_ _.py 2009-08-06 08:48:01 +0000 test_descriptio n == line[offset:-1]): ver.OUTSIDE_ TEST test_descriptio n = None addSuccess( self._current_ test) self.client, 'addExpectedFai lure', None)
> --- NEWS 2009-08-02 22:55:36 +0000
> +++ NEWS 2009-08-06 08:48:01 +0000
> @@ -32,6 +32,11 @@
>
> BUG FIXES:
>
> + * ``xfail`` outcomes are now passed to python TestResult's via
> + addExpectedFailure if it is present on the TestResult. Python 2.6 and
> + earlier which do not have this function will have ``xfail`` outcomes
> + passed through as success outcomes as earlier versions of subunit did.
> +
> API CHANGES:
>
> * When a progress: directive is encountered in a subunit stream, the
>
> === modified file 'python/
> --- python/
> +++ python/
> @@ -120,7 +120,11 @@
> self.current_
> self.state = TestProtocolSer
> self.current_
> - self.client.
> + xfail = getattr(
> + if callable(xfail):
Is there a way to avoid using 'callable' here? It's a little look before you
leap, and is not present in Python 3.
One way to do it would be to call it if not None, and catch a TypeError.
> + xfail(self. _current_ test, RemoteError()) addSuccess( self._current_ test) stopTest( self._current_ test) ver.TEST_ STARTED and test_descriptio n + " [" == line[offset:-1]): test_descriptio n = None or_error( self._message) stopTest( self._current_ test) ver.READING_ SUCCESS, ver.READING_ XFAIL, ver.READING_ XFAIL: ver.OUTSIDE_ TEST test_descriptio n = None self.client, 'addExpectedFai lure', None) _current_ test, RemoteError( self._message) )
> + else:
> + self.client.
> self.client.
> elif (self.state == TestProtocolSer
> self.current_
> @@ -203,10 +207,16 @@
> self.current_
> self._skip_
> self.client.
> - elif self.state in (
> - TestProtocolSer
> - TestProtocolSer
> - ):
> + elif self.state == TestProtocolSer
> + self.state = TestProtocolSer
> + self.current_
> + xfail = getattr(
> + if callable(xfail):
> + xfail(self.
This duplicates a bit of logic above.
> + else: addSuccess( self._current_ test) stopTest( self._current_ test) ver.READING_ SUCCESS: Received( line) subunit/ tests/test_ test_protocol. py' subunit/ tests/test_ test_protocol. py 2009-08-02 22:55:36 +0000 subunit/ tests/test_ test_protocol. py 2009-08-06 08:48:01 +0000 lServerClient( object) :
> + self.client.
> + self.client.
> + elif self.state == TestProtocolSer
> self._succeedTest()
> else:
> self.stdOutLine
>
> === modified file 'python/
> --- python/
> +++ python/
> @@ -28,7 +28,11 @@
>
>
> class MockTestProtoco
> - """A mock protocol server client to test callbacks."""
> + """A mock protocol server client to test callbacks.
> +
> + Note that this is deliberately not python 2.7 complete, to allow
'Python' not 'python'.
> + testing compatibility.
Can you please elaborate on _why_ not supporting Python 2.7 completely allows
testing compatibility?
> + """
>
> def __init__(self):
> self.end_calls = []
Thanks,
jml