Relative Content

Tag Archive for pytestfastapipytest-asyncio

Pytest/FastAPI asyncio tests run individually but fail when run as a group

I have a set of pytest tests that when run individually pass, but when run as a group fail. I am using an in-memory SQLite database, which is set up and torn down in async fixtures with the scope set to “function”. I have annotated the code and have seen this occurring. When the tests are run as a group it appears as if the database tables are created but the contents of the database are not added.