def check_db_locks(func):
 def new_func(app, *args, **kwargs):
  retval = func(app, *args, **kwargs)
  temp_session = app.session_factory()
  temp_session.execute('CREATE TABLE dummy (foo INT)')
  temp_session.execute('DROP TABLE dummy')
  temp_session.close()
  return retval
 return new_func

def check_db_locks ( func ) : def new_func ( app , * args , ** kwargs ) : retval = func ( app , * args , ** kwargs ) temp_session = app . session_factory ( ) temp_session . execute ( 'CREATE TABLE dummy (foo INT)' ) temp_session . execute ( 'DROP TABLE dummy' ) temp_session . close ( ) return retval return new_func
decorator for test functions that verifies no locks are held on the applications database upon exit by creating and dropping a dummy table .