I am pretty newbie in web testing. I would like to test my Flask web and API which uses SQLAlchemy using pytest.
I would like to test the behaviour of the Flask server when the database is empty and when the database is full.
Having the database empty and filling it with values on each test is not efficient.
I have tried to create two different Flask applications at the same time but I end up having errors due to having different contexts. For example:
...
AssertionError: Popped wrong app context. (<flask.ctx.AppContext object at 0x000001D896BD6F00> instead of <flask.ctx.AppContext object at 0x000001D8980EE090>)
...
AssertionError: Popped wrong request context. (<RequestContext 'http://localhost/' [GET] of project> instead of <RequestContext 'http://localhost/filters/edit/1' [GET] of project>
Can I have two differenty in memory sqlite databases for this purpose? Is there any efficient solution?