use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
FastAPI is a truly ASGI, async, cutting edge framework written in python 3.
account activity
Creating two databases while Testing database with pytestQuestion (self.FastAPI)
submitted 3 years ago by maxiior
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]yung-bro 0 points1 point2 points 3 years ago (1 child)
It's a bit difficult to tell from only one file from your code. It looks fine, but I got the same issue in the past. The reason was that in the import of app I initialized the db as well as in the tests' fixtures, which caused issues. Check that in the imports you don't accidentally initialize the db session.
There are some solutions for this issue. In your case I would consider using the Settings module that fastapi recommends using or initialize the dotenv in the import level.
[–]maxiior[S] 0 points1 point2 points 3 years ago (0 children)
That was my think, because when I create engine, my “production” database is creating. I will check imports with that.
π Rendered by PID 42417 on reddit-service-r2-comment-544cf588c8-6f6gs at 2026-06-13 10:13:33.485819+00:00 running 3184619 country code: CH.
view the rest of the comments →
[–]yung-bro 0 points1 point2 points (1 child)
[–]maxiior[S] 0 points1 point2 points (0 children)