I need use IsolatedAsyncioTestCase to Perform asynchronous verification why my code does not run in parallel or asynchronous, i need test2 、test3、test4 run in asynchronous
async def check_status(name:str):
print(f"before {name}")
await asyncio.sleep(5)
print(f"after {name}")
return True
class TestAsync(IsolatedAsyncioTestCase):
async def test_002(self):
print("test_002")
res = await check_status("test_002")
self.assertTrue(res)
async def test_003(self):
print("test_003")
res = await check_status("test_003")
self.assertTrue(res)
async def test_004(self):
print("test_004")
res = await check_status("test_004")
self.assertTrue(res)
if __name__ == "__main__":
unittest.main()
here is the output, still synchronized
test_002
before test_002
after test_002
test_003
before test_003
after test_003
test_004
before test_004
after test_004