You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to test app with TortoiseORM and i dont understand what is the right way to setup my test application in fixture.
I was tried to make with listeners and fixtures but i am always how problems with event loop, or tortoise can't connect to the database, or fixture doesnt work and etc. And i can't find any example on stackoverflow/github with testing Sanic with tortoise and test databases.
Can you show me the best way to setup tests for testing Sanic & TortoiseORM on the test db (e.g. sqlite) ?
p.s I think i can use sqlite:///:memory for
The text was updated successfully, but these errors were encountered:
I cannot advise on any best practices with an ORM, you will have to turn to them for that.
GENERALLY, I would say your testing should NOT hit any database. Instead you should use mocking to retrieve fake data in your tests. When you have to start incorporating networking calls and state management into tests it gets pretty complex quickly.
I cover some testing strategies specifically dealing with DB interactions in my book. Generally, I just point people to the companion code in GH, but I think the concepts you are aiming for are much more complex and you really should look deeper into the topic of testing. IMO the problem is in strategy not implementation.
Need to understand the working of sanic-testing, specifically app running part, when we provide an app fixture which typically has our routes/blueprints and middlewares and maybe listeners, are listeners not executed when it "runs" the app?
I am trying to test app with TortoiseORM and i dont understand what is the right way to setup my test application in fixture.
I was tried to make with listeners and fixtures but i am always how problems with event loop, or tortoise can't connect to the database, or fixture doesnt work and etc. And i can't find any example on stackoverflow/github with testing Sanic with tortoise and test databases.
Can you show me the best way to setup tests for testing Sanic & TortoiseORM on the test db (e.g. sqlite) ?
p.s I think i can use sqlite:///:memory for
The text was updated successfully, but these errors were encountered: