fix: Deque mutated during iteration (#24550)

This commit is contained in:
Michael S. Molina 2023-06-29 12:12:12 -03:00 committed by GitHub
parent 66f59e5797
commit bb1db9e86f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View File

@ -850,23 +850,23 @@ def pessimistic_connection_handling(some_engine: Engine) -> None:
# restore 'close with result' # restore 'close with result'
connection.should_close_with_result = save_should_close_with_result connection.should_close_with_result = save_should_close_with_result
if some_engine.dialect.name == "sqlite": if some_engine.dialect.name == "sqlite":
@event.listens_for(some_engine, "connect") @event.listens_for(some_engine, "connect")
def set_sqlite_pragma( # pylint: disable=unused-argument def set_sqlite_pragma( # pylint: disable=unused-argument
connection: sqlite3.Connection, connection: sqlite3.Connection,
*args: Any, *args: Any,
) -> None: ) -> None:
r""" r"""
Enable foreign key support for SQLite. Enable foreign key support for SQLite.
:param connection: The SQLite connection :param connection: The SQLite connection
:param \*args: Additional positional arguments :param \*args: Additional positional arguments
:see: https://docs.sqlalchemy.org/en/latest/dialects/sqlite.html :see: https://docs.sqlalchemy.org/en/latest/dialects/sqlite.html
""" """
with closing(connection.cursor()) as cursor: with closing(connection.cursor()) as cursor:
cursor.execute("PRAGMA foreign_keys=ON") cursor.execute("PRAGMA foreign_keys=ON")
def send_email_smtp( # pylint: disable=invalid-name,too-many-arguments,too-many-locals def send_email_smtp( # pylint: disable=invalid-name,too-many-arguments,too-many-locals

View File

@ -35,7 +35,7 @@ def test_create_ssh_tunnel():
"password": "bar", "password": "bar",
} }
result = SSHTunnelDAO.create(properties) result = SSHTunnelDAO.create(properties, commit=False)
assert result is not None assert result is not None
assert isinstance(result, SSHTunnel) assert isinstance(result, SSHTunnel)