From: Daniele Varrazzo Date: Fri, 9 May 2025 14:34:37 +0000 (+0200) Subject: chore: import module to avoid confusing mypy situations X-Git-Tag: 3.2.8~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02a12bf6d9721a0cf433d55351b568629b98025a;p=thirdparty%2Fpsycopg.git chore: import module to avoid confusing mypy situations --- diff --git a/tests/test_connection_info.py b/tests/test_connection_info.py index a50237d48..ed0ace352 100644 --- a/tests/test_connection_info.py +++ b/tests/test_connection_info.py @@ -3,6 +3,7 @@ import datetime as dt import pytest import psycopg +import psycopg.pq._pq_ctypes from psycopg.conninfo import conninfo_to_dict, make_conninfo from psycopg._encodings import pg2pyenc @@ -47,9 +48,7 @@ def test_port(conn): @pytest.mark.skipif(psycopg.pq.__impl__ != "python", reason="can't monkeypatch C") def test_blank_port(conn, monkeypatch): monkeypatch.setenv("PGPORT", "9999") - monkeypatch.setattr( - psycopg.pq._pq_ctypes, "PQport", lambda self: b"" # type: ignore[attr-defined] - ) + monkeypatch.setattr(psycopg.pq._pq_ctypes, "PQport", lambda self: b"") assert conn.pgconn.port == b"" # assume 5432 is the compiled value assert conn.info.port == 5432