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 think I found some misconfiuration in a part where you implement SQLAlchemy in place of a standard sqlite3 library to initiate and test the db.
The following part doesn't seem to work:
The Client Fixture is not creating a new test.db everytime the tests are run. Instead the flaskr.db gets created, breaking the app every time you run the test. Seems like sqlalchemy is always using the app.config from the app.py instead the ones from the test file.
If you follow the guide step-by-step it's hard to notice, because the old test.db is still there after implementing SQLAlchemy (you mention to only delete the old flaskr.db) and all the tests passes the first time you run them after SQLAlchemy is there.
Also the part I don't quite understand yet, is why the flaskr.db database needs to be created manually using the create_db.py script. If I delete the db and let the app.py create it on first run, the flaskr.db gets created, but the post table isn't there.
I'll try to figure it out myself but I would be grateful for any tips :)
I'm still a total Python noob so forgive me if I missed something obvious here.
The text was updated successfully, but these errors were encountered:
Hi.
I think I found some misconfiuration in a part where you implement SQLAlchemy in place of a standard sqlite3 library to initiate and test the db.
The following part doesn't seem to work:
The Client Fixture is not creating a new test.db everytime the tests are run. Instead the flaskr.db gets created, breaking the app every time you run the test. Seems like sqlalchemy is always using the app.config from the app.py instead the ones from the test file.
If you follow the guide step-by-step it's hard to notice, because the old test.db is still there after implementing SQLAlchemy (you mention to only delete the old flaskr.db) and all the tests passes the first time you run them after SQLAlchemy is there.
Also the part I don't quite understand yet, is why the flaskr.db database needs to be created manually using the create_db.py script. If I delete the db and let the app.py create it on first run, the flaskr.db gets created, but the post table isn't there.
I'll try to figure it out myself but I would be grateful for any tips :)
I'm still a total Python noob so forgive me if I missed something obvious here.
The text was updated successfully, but these errors were encountered: