(self, extra_step)
| 2064 | |
| 2065 | @testing.combinations("detach", "invalidate", "return") |
| 2066 | def test_custom(self, extra_step): |
| 2067 | dbapi, p = self._fixture(reset_on_return=None) |
| 2068 | |
| 2069 | @event.listens_for(p, "reset") |
| 2070 | def custom_reset(dbapi_conn, record, reset_state): |
| 2071 | dbapi_conn.special_reset_method(reset_state) |
| 2072 | |
| 2073 | c1 = p.connect() |
| 2074 | |
| 2075 | if extra_step == "detach": |
| 2076 | c1.detach() |
| 2077 | elif extra_step == "invalidate": |
| 2078 | c1.invalidate() |
| 2079 | c1.close() |
| 2080 | |
| 2081 | special_event = mock.call.special_reset_method( |
| 2082 | PoolResetState( |
| 2083 | transaction_was_reset=False, |
| 2084 | terminate_only=extra_step == "detach", |
| 2085 | asyncio_safe=True, |
| 2086 | ) |
| 2087 | ) |
| 2088 | if extra_step == "detach": |
| 2089 | expected = [special_event, mock.call.close()] |
| 2090 | elif extra_step == "invalidate": |
| 2091 | expected = [mock.call.close()] |
| 2092 | else: |
| 2093 | expected = [special_event] |
| 2094 | eq_(dbapi.connect().mock_calls, expected) |
| 2095 | |
| 2096 | assert not dbapi.connect().rollback.called |
| 2097 | assert not dbapi.connect().commit.called |
| 2098 | |
| 2099 | @testing.combinations(True, False, argnames="assert_w_event") |
| 2100 | @testing.combinations(True, False, argnames="use_engine_transaction") |
nothing calls this directly
no test coverage detected