Author zach.ware
Recipients Petter S, asvetlov, njs, pdxjohnny, r.david.murray, yselivanov, zach.ware
Date 2018-03-12.20:30:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1520886608.09.0.467229070634.issue32972@psf.upfronthosting.co.za>
In-reply-to
Content
1. I'm still -1 on a separate subclass, especially since the subclass should still be compatible with the base class.

2. This is only in consideration for 3.8 (even 3.7 is past feature freeze at this point), so the version-dependent behavior is unnecessary.

3. I agree that the `super().setUp()` idiom precludes allowing `setUp` and `tearDown` to be synchronous or asynchronous unless the idiom becomes `self.runMethod(super().setUp)`, but that's longer and harder to remember.  `setUpClass` and `tearDownClass` also need to be considered.

You also still need to add tests.

`addCleanup` is an open question; I think it could handle sync or async on its own but could be convinced otherwise.


Andrew: Judging by your questions in msg313481 I think my description of `coroutine_runner` was not specific enough.  The basic idea is that unittest.case.TestCase is defined with `coroutine_runner = asyncio.run`, and if you need something else then you do:

class MyTest(TestCase):

    # I assume trio has something like this :)
    coroutine_runner = trio.run

    async def test_something_in_trio(self):
        self.assertTrue(1)


asyncio gets the special treatment of having its runner set by default by virtue of being in the standard library.

I'm certainly open to better naming :)
History
Date User Action Args
2018-03-12 20:30:08zach.waresetrecipients: + zach.ware, r.david.murray, njs, asvetlov, yselivanov, pdxjohnny, Petter S
2018-03-12 20:30:08zach.waresetmessageid: <1520886608.09.0.467229070634.issue32972@psf.upfronthosting.co.za>
2018-03-12 20:30:08zach.warelinkissue32972 messages
2018-03-12 20:30:08zach.warecreate