I have a test to verify an exception is thrown from an async response, which I'm using pytest-asyncio version 0.10.0 to run.
Code is basically:
class TestThis:
@pytest.mark.asyncio
def test_the_thing(self):
arg1 = "cmd"
arg2 = "second command"
with pytest.raises(CustomException):
await do_thing(arg1, arg2)
Now the really weird thing is this test works fine if I run it alone, or if I run the class alone. However when I run all tests (pytest at the project root), it fails every time with a runtime error, saying the loop is closed.