From 7edea5834849bd828100d62e2ecaa166242aad92 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 9 May 2025 16:36:55 +0200 Subject: [PATCH] chore(tests): import module only locally as it won't be imported/used in C --- tests/test_connection_info.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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"" -- 2.47.2