From: Daniele Varrazzo Date: Fri, 13 May 2022 00:21:10 +0000 (+0200) Subject: fix: set ClientCursor class module to psycopg X-Git-Tag: 3.1~99^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7339c6294ef2b97976b1e860018bc58181e7884c;p=thirdparty%2Fpsycopg.git fix: set ClientCursor class module to psycopg --- diff --git a/psycopg/psycopg/client_cursor.py b/psycopg/psycopg/client_cursor.py index a61d10234..9c560bb3d 100644 --- a/psycopg/psycopg/client_cursor.py +++ b/psycopg/psycopg/client_cursor.py @@ -81,10 +81,10 @@ class ClientCursorMixin(BaseCursor[ConnectionType, Row]): class ClientCursor(ClientCursorMixin["Connection[Row]", Row], Cursor[Row]): - pass + __module__ = "psycopg" class AsyncClientCursor( ClientCursorMixin["AsyncConnection[Row]", Row], AsyncCursor[Row] ): - pass + __module__ = "psycopg" diff --git a/tests/test_client_cursor.py b/tests/test_client_cursor.py index df202ea7b..8b403c182 100644 --- a/tests/test_client_cursor.py +++ b/tests/test_client_cursor.py @@ -731,6 +731,7 @@ class TestColumn: def test_str(conn): cur = conn.cursor() + assert "psycopg.ClientCursor" in str(cur) assert "[IDLE]" in str(cur) assert "[closed]" not in str(cur) assert "[no result]" in str(cur) diff --git a/tests/test_client_cursor_async.py b/tests/test_client_cursor_async.py index 988ea57ec..780d81706 100644 --- a/tests/test_client_cursor_async.py +++ b/tests/test_client_cursor_async.py @@ -605,6 +605,7 @@ async def test_stream(aconn): async def test_str(aconn): cur = aconn.cursor() + assert "psycopg.AsyncClientCursor" in str(cur) assert "[IDLE]" in str(cur) assert "[closed]" not in str(cur) assert "[no result]" in str(cur) diff --git a/tests/test_cursor.py b/tests/test_cursor.py index a52b3fc37..29c726c33 100644 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -778,6 +778,7 @@ class TestColumn: def test_str(conn): cur = conn.cursor() + assert "psycopg.Cursor" in str(cur) assert "[IDLE]" in str(cur) assert "[closed]" not in str(cur) assert "[no result]" in str(cur) diff --git a/tests/test_cursor_async.py b/tests/test_cursor_async.py index ea5bf7b13..6d63bed14 100644 --- a/tests/test_cursor_async.py +++ b/tests/test_cursor_async.py @@ -649,6 +649,7 @@ async def test_stream_binary_cursor_text_override(aconn): async def test_str(aconn): cur = aconn.cursor() + assert "psycopg.AsyncCursor" in str(cur) assert "[IDLE]" in str(cur) assert "[closed]" not in str(cur) assert "[no result]" in str(cur) diff --git a/tests/test_server_cursor.py b/tests/test_server_cursor.py index 78b51ce00..e1a9da446 100644 --- a/tests/test_server_cursor.py +++ b/tests/test_server_cursor.py @@ -42,7 +42,7 @@ def test_funny_name(conn): def test_repr(conn): cur = conn.cursor("my-name") - assert "ServerCursor" in repr(cur) + assert "psycopg.ServerCursor" in str(cur) assert "my-name" in repr(cur) cur.close() diff --git a/tests/test_server_cursor_async.py b/tests/test_server_cursor_async.py index 6b2b9a5e5..8ccf68651 100644 --- a/tests/test_server_cursor_async.py +++ b/tests/test_server_cursor_async.py @@ -48,7 +48,7 @@ async def test_funny_name(aconn): async def test_repr(aconn): cur = aconn.cursor("my-name") - assert "AsyncServerCursor" in repr(cur) + assert "psycopg.AsyncServerCursor" in str(cur) assert "my-name" in repr(cur) await cur.close()