]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Move Windows test to separate file to avoid applying the asyncio mark 224/head
authorH <juana.galan@outlook.com>
Thu, 10 Feb 2022 23:50:41 +0000 (23:50 +0000)
committerH <juana.galan@outlook.com>
Thu, 10 Feb 2022 23:50:41 +0000 (23:50 +0000)
tests/test_connection_async.py
tests/test_windows.py [new file with mode: 0644]

index 2d471c7f9fe62b68d9019bf7140713a3e1d375ae..804c7bcd251c4b97afe05e1939f3c235ca168ec6 100644 (file)
@@ -1,14 +1,12 @@
 import time
 import pytest
-import asyncio
 import logging
-import sys
 import weakref
 
 import psycopg
 from psycopg import AsyncConnection, Notify
 from psycopg.rows import tuple_row
-from psycopg.errors import InterfaceError, UndefinedTable
+from psycopg.errors import UndefinedTable
 from psycopg.conninfo import conninfo_to_dict, make_conninfo
 
 from .utils import gc_collect
@@ -688,21 +686,3 @@ async def test_connect_context_copy(dsn, aconn):
     cur = await aconn2.execute("select %b", ["hello"])
     assert (await cur.fetchone())[0] == "hellob"  # type: ignore[index]
     await aconn2.close()
-
-
-@pytest.mark.skipif(sys.platform != "win32", reason="windows only test")
-def test_windows_error(dsn):
-    loop = asyncio.ProactorEventLoop()  # type: ignore[attr-defined]
-
-    async def go():
-        with pytest.raises(
-            InterfaceError,
-            match="Psycopg cannot use the 'ProactorEventLoop'",
-        ):
-            await psycopg.AsyncConnection.connect(dsn)
-
-    try:
-        loop.run_until_complete(go())
-    finally:
-        loop.run_until_complete(loop.shutdown_asyncgens())
-        loop.close()
diff --git a/tests/test_windows.py b/tests/test_windows.py
new file mode 100644 (file)
index 0000000..bb491cd
--- /dev/null
@@ -0,0 +1,24 @@
+import pytest
+import asyncio
+import sys
+
+import psycopg
+from psycopg.errors import InterfaceError
+
+
+@pytest.mark.skipif(sys.platform != "win32", reason="windows only test")
+def test_windows_error(dsn):
+    loop = asyncio.ProactorEventLoop()  # type: ignore[attr-defined]
+
+    async def go():
+        with pytest.raises(
+            InterfaceError,
+            match="Psycopg cannot use the 'ProactorEventLoop'",
+        ):
+            await psycopg.AsyncConnection.connect(dsn)
+
+    try:
+        loop.run_until_complete(go())
+    finally:
+        loop.run_until_complete(loop.shutdown_asyncgens())
+        loop.close()