Make sure to not carry on state between test cases
@@ -3,7 +3,7 @@ import pytest
@pytest.yield_fixture(scope='function')
def tables():
- from tensorhive.database import Base, engine
+ from tensorhive.database import Base, engine, db_session
from tensorhive.models.User import User
from tensorhive.models.Group import Group, User2Group
from tensorhive.models.Reservation import Reservation
@@ -13,5 +13,6 @@ def tables():
from tensorhive.models.Role import Role
from tensorhive.models.RevokedToken import RevokedToken
Base.metadata.create_all(engine)
+ db_session.remove() # that makes sure we won't be holding on to any cached entities between test cases
yield
Base.metadata.drop_all(engine)
