I have the following code:
import asyncio
import pytest
from mymodule import myasyncfunction
from unittest import TestCase
class TestDummy(TestCase):
def setUp(self):
await myasyncfunction()
@pytest.mark.asyncio
async def test_dummy(self):
assert False
The test passes because it doesn't enter the test at all. It only says:
RuntimeWarning: coroutine 'TestDummy.setUp' was never awaited
How to make the setUp function async?
Observation: If I remove the inheritance from TestCase the test runs but it won't enter the setUp function before, which is needed.