File tree Expand file tree Collapse file tree 2 files changed +1
-36
lines changed Expand file tree Collapse file tree 2 files changed +1
-36
lines changed Original file line number Diff line number Diff line change 1- import contextlib
21import os
2+ import contextlib
33
44import pytest
55import sqlalchemy as sa
@@ -153,12 +153,6 @@ def raw_connection():
153153
154154 engine .raw_connection = raw_connection
155155
156- # Fix SessionTransaction._connection_for_bind caching
157- @sa .event .listens_for (session , 'after_begin' )
158- def after_begin (session , transaction , conn ):
159- if engine not in transaction ._connections :
160- transaction ._connections [engine ] = transaction ._connections [conn ]
161-
162156 for mocked_engine in pytestconfig ._mocked_engines :
163157 mocker .patch (mocked_engine , new = engine )
164158
Original file line number Diff line number Diff line change @@ -336,32 +336,3 @@ def test_delete_message(account_address, db_session):
336336
337337 result = db_testdir .runpytest ()
338338 result .assert_outcomes (passed = 1 )
339-
340-
341- def test_rollback_nested (db_testdir ):
342- '''
343- Test that creating objects and emitting SQL in the ORM won't bleed into
344- other tests.
345- '''
346- # Load tests from file
347- db_testdir .makepyfile ("""
348- def test_rollback_nested(person, db_session, caplog):
349- assert db_session.query(person).count() == 0
350- n1 = db_session.begin_nested()
351- db_session.add(person())
352- assert db_session.query(person).count() == 1
353-
354- n2 = db_session.begin_nested()
355- db_session.add(person())
356- assert db_session.query(person).count() == 2
357-
358- n2.rollback()
359- print(db_session.bind.mock_calls)
360- assert db_session.query(person).count() == 1
361- n1.rollback()
362- assert db_session.query(person).count() == 0
363- """ )
364-
365- # Run tests
366- result = db_testdir .runpytest ()
367- result .assert_outcomes (passed = 1 )
You can’t perform that action at this time.
0 commit comments