Skip to content

Commit

Permalink
Improve SQLAlchemy tests session cleanup
Browse files Browse the repository at this point in the history
The remove method rolls back the transaction, but also releases
associated objects.

https://docs.sqlalchemy.org/en/14/orm/contextual.html#sqlalchemy.orm.scoping.scoped_session.remove
  • Loading branch information
kingbuzzman authored and francoisfreitag committed Jun 28, 2022
1 parent 05e7d96 commit 6c243a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def setUp(self):
models.Base.metadata.create_all(models.engine)

def tearDown(self):
models.session.rollback()
models.session.remove()
models.Base.metadata.drop_all(models.engine)


Expand Down

0 comments on commit 6c243a7

Please sign in to comment.