]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix mock issue in pool test
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 24 Aug 2022 17:06:09 +0000 (13:06 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 24 Aug 2022 17:06:09 +0000 (13:06 -0400)
Due to the change for #5648 in ad14471bc99c2fb2315d3333a95dd,
the mock in test_recycle_pool_no_race needs to implement
an empty handle_error dispatcher.

the exception was in a thread so did not interrupt the
test suite:

File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py", line 2059, in _handle_dbapi_exception
      for fn in self.dialect.dispatch.handle_error:
  TypeError: 'Mock' object is not iterable

Change-Id: I764357c48aa1bf53a572d8ee24c89a7463505092

test/engine/test_pool.py

index 2bbb976a84c50086d9ac07e5e8ee0c73958f6da3..c66ebfa6c66498d3a923cf0dd2419df116048290 100644 (file)
@@ -1663,6 +1663,7 @@ class QueuePoolTest(PoolTestBase):
 
         dialect = Mock()
         dialect.is_disconnect = lambda *arg, **kw: True
+        dialect.dispatch = Mock(handle_error=[])
         dialect.dbapi.Error = dialect.loaded_dbapi.Error = Error
 
         pools = []