From: Daniele Varrazzo Date: Fri, 9 May 2025 14:36:55 +0000 (+0200) Subject: chore(tests): import module only locally as it won't be imported/used in C X-Git-Tag: 3.2.8~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7edea5834849bd828100d62e2ecaa166242aad92;p=thirdparty%2Fpsycopg.git chore(tests): import module only locally as it won't be imported/used in C --- diff --git a/tests/test_connection_info.py b/tests/test_connection_info.py index ed0ace352..2ff96e06c 100644 --- a/tests/test_connection_info.py +++ b/tests/test_connection_info.py @@ -3,7 +3,6 @@ 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,6 +46,9 @@ def test_port(conn): @pytest.mark.skipif(psycopg.pq.__impl__ != "python", reason="can't monkeypatch C") def test_blank_port(conn, monkeypatch): + + import psycopg.pq._pq_ctypes + monkeypatch.setenv("PGPORT", "9999") monkeypatch.setattr(psycopg.pq._pq_ctypes, "PQport", lambda self: b"") assert conn.pgconn.port == b""