vendredi 24 juin 2016

Flask unittest w/ flask-sqlalchemy autoflush error

When trying to run a unittest I am getting this error:

StatementError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (exceptions.ValueError) invalid literal for int() with base 10: 'True'

Here is the code: http://ift.tt/28RsYLP

The only thing that makes sense to me is that the flush is somehow shifting the values.

This issue only happens with the unittest, the application runs fine otherwise. Here is the code to launch the app: http://ift.tt/28TVdx3

So I'm guessing that's it's either: 1. Something wrong with the app context 2. The db engine, session, etc. 3. Those dang ol circular imports

The other major difference is that the main application is using postgres with the unittest uses sqllite.

Any help with figuring this out would be hugely appreciated, and hopefully can help others who run into the same issue.

Aucun commentaire:

Enregistrer un commentaire