[Twisted-Python] Re: [Twisted-commits] r22733 - Add clear() method to TestSuite, play with DocTestSuite (ahah some much fun).

Jean-Paul Calderone exarkun at divmod.com
Sat Mar 1 10:26:25 EST 2008


On Sat, 01 Mar 2008 10:39:49 +0100, Thomas Hervé <therve at free.fr> wrote:
>Jonathan Lange a écrit :
>>On Sat, Mar 1, 2008 at 9:02 AM, Thomas Herve
>><therve at wolfwood.twistedmatrix.com> wrote:
>>
>>>  @@ -1241,6 +1242,13 @@
>>>          return result
>>>
>>>
>>>  +    def clear(self):
>>>  +        """
>>>  +        Remove all previously added tests.
>>>  +        """
>>>  +        self._tests = []
>>>  +
>>What's your plan for making sure this works with stdlib TestSuite?
>>
>>jml
>>
>
>I haven't think about it much. The tests aren't broken, so the behavior is 
>not really defined. I could just check if the method exists, but that 
>doesn't seem very nice. Maybe we could have a ITestSuite interface to add 
>specific behavior to the twisted TestSuite object (and then check the 
>interface). Or maybe I could just let the old self._tests = [], but exarkun 
>wasn't very happy about that.
>
>What do you think?

We're already adapting everything we come across to ITestCase.  It seems
that clear should be a method of that interface.  If necessary, we can
provide an adapter from the stdlib TestSuite which defines that method.
Testing should be a simple matter then.

Jean-Paul




More information about the Twisted-Python mailing list