Zachary Ware <zachary.w...@gmail.com> added the comment:

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 :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32972>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to