on-internet
← Community

operational error when testing my CLI app with a SQLite DB

Stack Overflow ·

So I wanted to add tests to my CLI app, but I am struggling to replace my db with a temporary one. So far I have used SQLModel for database access, but for the app testing I want to assert the db values using raw SQL statements. However, I get a connection error when trying to access my temporary DB. sqlite3.OperationalError: unable to open database file My plan so far is the following: In my test file I replace the sqlite uri with one directing it to a sqlite db in a temporary dictionary (using pytest tmp_path). My assumption was, that if I create that DB with SQLModel, I'd be able to access

Comments

Sign in or sign up to comment and upvote.

No comments yet.