From 43f329badf4756e05c00937053a8ddbbac9dd030 Mon Sep 17 00:00:00 2001 From: TLSM Date: Tue, 7 Feb 2023 07:04:02 -0500 Subject: [PATCH] Fix Session expiry for tests This is likely not an issue for production (since each request will get its own SQLAlchemy session), but `scoped_session` results in the tests reuseing the same Session across tests. The tests rely on the default session expiry behavior. --- files/routes/posts.py | 1 + 1 file changed, 1 insertion(+) diff --git a/files/routes/posts.py b/files/routes/posts.py index e72bb9319..03d97ee19 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -238,6 +238,7 @@ def post_id(pid, anything=None, v=None, sub=None): g.db.expire_on_commit = False g.db.add(post) g.db.commit() + g.db.expire_on_commit = True if request.headers.get("Authorization"): return post.json else: