]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Reuse fixture across test module
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 15 Dec 2021 00:24:28 +0000 (01:24 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 15 Dec 2021 00:28:29 +0000 (01:28 +0100)
The fixture is duplicated. Funnily enough, the dupe in async is less
efficient than the one in the sync test module, but it allowed to spot
the bug at the previous commit, after using it more than the prepared
threshold.

Ungratefully dropping it.

tests/test_cursor_async.py

index dd9009b49fbc6963129dbfdfc8e42e39e34b41dc..9a73f8456b0b80d2e92a850b883dc757d3536ce6 100644 (file)
@@ -10,7 +10,9 @@ from psycopg.adapt import PyFormat
 
 from .utils import gc_collect
 from .test_cursor import my_row_factory
+from .test_cursor import execmany, _execmany  # noqa: F401
 
+execmany = execmany  # avoid F811 underneath
 pytestmark = pytest.mark.asyncio
 
 
@@ -233,17 +235,6 @@ async def test_query_badenc(aconn):
         await cur.execute("select '\u20ac'")
 
 
-@pytest.fixture(scope="function")
-async def execmany(svcconn):
-    cur = svcconn.cursor()
-    cur.execute(
-        """
-        drop table if exists execmany;
-        create table execmany (id serial primary key, num integer, data text)
-        """
-    )
-
-
 async def test_executemany(aconn, execmany):
     cur = aconn.cursor()
     await cur.executemany(