Message313211
I am wondering whether it would be useful for unittest.TestCase to automatically run test methods that are coroutines within the default asyncio loop.
Example:
class TestAsync(unittest.TestCase):
async def test_foo(self):
result = await foo()
self.assertEqual(result, 42)
the test runner would then run test_foo within the default loop. If needed, we could also add functionality for providing a loop other than the default to the test class.
It seems to me that this functionality would be pretty easy to add to Lib/unittest/case.py:615 .
Personally, I think it would be useful. Right now I have to append every test case with a personal @run_in_loop decorator and I think unittest.TestCase could do this for me without breaking anything. |
|
Date |
User |
Action |
Args |
2018-03-04 12:39:17 | Petter S | set | recipients:
+ Petter S |
2018-03-04 12:39:16 | Petter S | set | messageid: <1520167156.98.0.467229070634.issue32992@psf.upfronthosting.co.za> |
2018-03-04 12:39:16 | Petter S | link | issue32992 messages |
2018-03-04 12:39:16 | Petter S | create | |
|