[Twisted-Python] Re: [Twisted-commits] r15100 - So I really do want this stuff

Jean-Paul Calderone exarkun at divmod.com
Sun Nov 13 00:16:04 EST 2005


On Sun, 13 Nov 2005 13:48:13 +1100, Jonathan Lange <jml at mumak.net> wrote:
>On 13/11/05, Jonathan Lange <jml at mumak.net> wrote:
>> On 13/11/05, James Y Knight <foom at fuhm.net> wrote:
>> > On Nov 12, 2005, at 4:34 PM, Jonathan Lange wrote:
>> > > On 13/11/05, James Y Knight <foom at fuhm.net> wrote:
>> > >>
>> > >> Maybe this is a stupid question, but I'm confused as to why the
>> > >> implementation isn't straightforward, something along the lines of
>> > >> the following:
>> > >>
>
>Also, I should point out that implementing setUpClass using resources
>will (probably -- I haven't benchmarked) make tests run faster.
>
>Say you have a base:
>
>class ComplexBase(unittest.TestCase):
>  def setUpClass(self):
>    """do complex stuff"""
>
>  def tearDownClass(self):
>    """do complex stuff"""
>
>class A(ComplexBase):
>  def test1(self):
>    pass
>
>class B(ComplexBase):
>  def test2(self):
>    pass
>
>Then, with resources, the run order will be:
>    setUpClass
>    test1
>    test2
>    tearDownClass
>
>As opposed to:
>    setUpClass
>    test1
>    tearDownClass
>    setUpClass
>    test2
>    tearDownClass

This seems like a pretty major change in semantics.  I wonder if existing code that relies on the existing behavior can stand to have it made.

Jean-Paul




More information about the Twisted-Python mailing list