def test_prohibit_commit_specific_session_only(self): """ Test that "prohibit_commit" applies only to the given session object, not any other session objects that may be used """ # We _want_ another session. By default this would be the _same_ # session we already had other_session = Session.session_factory() assert other_session is not self.session with prohibit_commit(self.session): self.session.execute('SELECT 1') with pytest.raises(RuntimeError): self.session.commit() self.session.rollback() other_session.execute('SELECT 1') other_session.commit()