def test_db_session_always_fresh(self): s = db.get_session() try: r = ReportStore() s.add(r) s.commit() r.id = None s.commit() except: pass # if the session is not cleaned up properly, this will throw an exception s = db.get_session() s.execute('select 1').fetchall() s = db.get_mw_session(mediawiki_project) try: u = MediawikiUser() s.add(u) s.commit() u.user_id = None s.commit() except: pass # if the session is not cleaned up properly, this will throw an exception s = db.get_mw_session(mediawiki_project) s.execute('select 1').fetchall()