jarus / flask-testing

Unittest extensions for Flask
http://pythonhosted.org/Flask-Testing/
Other
502 stars 111 forks source link

Improve Docs: what flask-testing does and what it does not #114

Open imaia opened 6 years ago

imaia commented 6 years ago

It would be nice to have it crystal clear what flask-testing does and does not in docs. Does it integrate with sqlalchemy in any way beyond session removal? Does it drop tables between tests?

ghost commented 6 years ago

The docs at http://pythonhosted.org/Flask-Testing/ say that you need to manually drop the tables and remove the session.

Second, it’s usually a good idea to create and drop your tables with each test run, to ensure clean tests

Notice also that db.session.remove() is called at the end of each test, to ensure the SQLAlchemy session is properly removed and that a new session is started with each test run - this is a common “gotcha”.