コード例 #1
0
ファイル: testing.py プロジェクト: BigData-Tools/everest
 def __exit__(self, ext_type, value, tb):
     # Roll back the outer transaction and close the connection.
     self.__session.close()
     self.__transaction.rollback()
     self.__connection.close()
     # Remove the session we created.
     Session.remove()
     # Restore autoflush flag.
     Session.configure(autoflush=self.__old_autoflush_flag)
コード例 #2
0
 def __exit__(self, ext_type, value, tb):
     # Roll back the outer transaction and close the connection.
     self.__session.close()
     self.__transaction.rollback()
     self.__connection.close()
     # Remove the session we created.
     Session.remove()
     # Restore autoflush flag.
     Session.configure(autoflush=self.__old_autoflush_flag)
コード例 #3
0
ファイル: testing.py プロジェクト: BigData-Tools/everest
 def __enter__(self):
     # We set up an outer transaction that allows us to roll back all
     # changes (including commits) the unittest may want to make.
     engine = get_engine(self.__engine_name)
     self.__connection = engine.connect()
     self.__transaction = self.__connection.begin()
     # Configure the autoflush behavior of the session.
     self.__old_autoflush_flag = Session.autoflush # pylint:disable=E1101
     Session.remove()
     Session.configure(autoflush=self.__autoflush)
     # Throw out the Zope transaction manager for testing.
     Session.configure(extension=None)
     # Create a new session for the tests.
     self.__session = Session(bind=self.__connection)
     return self.__session
コード例 #4
0
 def __enter__(self):
     # We set up an outer transaction that allows us to roll back all
     # changes (including commits) the unittest may want to make.
     engine = get_engine(self.__engine_name)
     self.__connection = engine.connect()
     self.__transaction = self.__connection.begin()
     # Configure the autoflush behavior of the session.
     self.__old_autoflush_flag = Session.autoflush  # pylint:disable=E1101
     Session.remove()
     Session.configure(autoflush=self.__autoflush)
     # Throw out the Zope transaction manager for testing.
     Session.configure(extension=None)
     # Create a new session for the tests.
     self.__session = Session(bind=self.__connection)
     return self.__session