From: Daniele Varrazzo Date: Thu, 10 Aug 2023 00:37:22 +0000 (+0100) Subject: fix: rename QueuedLibpqWriter object X-Git-Tag: pool-3.1.8~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8f27fc81be8e681a1cf11c36926dc16f98c7243;p=thirdparty%2Fpsycopg.git fix: rename QueuedLibpqWriter object It was mistakenly named Driver, not Writer. --- diff --git a/psycopg/psycopg/copy.py b/psycopg/psycopg/copy.py index df2975f6e..10701e148 100644 --- a/psycopg/psycopg/copy.py +++ b/psycopg/psycopg/copy.py @@ -389,7 +389,7 @@ class LibpqWriter(Writer): self.cursor._results = [res] -class QueuedLibpqDriver(LibpqWriter): +class QueuedLibpqWriter(LibpqWriter): """ A writer using a buffer to queue data to write to a Postgres database. diff --git a/tests/test_copy.py b/tests/test_copy.py index 29fad4581..2c21368ae 100644 --- a/tests/test_copy.py +++ b/tests/test_copy.py @@ -12,7 +12,7 @@ from psycopg import pq from psycopg import sql from psycopg import errors as e from psycopg.pq import Format -from psycopg.copy import Copy, LibpqWriter, QueuedLibpqDriver, FileWriter +from psycopg.copy import Copy, LibpqWriter, QueuedLibpqWriter, FileWriter from psycopg.adapt import PyFormat from psycopg.types import TypeInfo from psycopg.types.hstore import register_hstore @@ -643,7 +643,7 @@ def test_worker_life(conn, format, buffer): cur = conn.cursor() ensure_table(cur, sample_tabledef) with cur.copy( - f"copy copy_in from stdin (format {format.name})", writer=QueuedLibpqDriver(cur) + f"copy copy_in from stdin (format {format.name})", writer=QueuedLibpqWriter(cur) ) as copy: assert not copy.writer._worker copy.write(globals()[buffer]) @@ -663,7 +663,7 @@ def test_worker_error_propagated(conn, monkeypatch): cur = conn.cursor() cur.execute("create temp table wat (a text, b text)") with pytest.raises(ZeroDivisionError): - with cur.copy("copy wat from stdin", writer=QueuedLibpqDriver(cur)) as copy: + with cur.copy("copy wat from stdin", writer=QueuedLibpqWriter(cur)) as copy: copy.write("a,b")