]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Windows compatibility for tests
authorDaniel Fortunov <github@danielfortunov.com>
Thu, 26 Nov 2020 08:33:53 +0000 (08:33 +0000)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 26 Nov 2020 12:21:00 +0000 (12:21 +0000)
* Skip test_connect_timeout() on Windows for the time being as
  Connection.connect() hangs for some reason. This skip can probably
  go away once connection timeouts are implemented.
* test_multiprocess_close(): Turn LocalPath instance back into a str
  before putting it back into env["PYTHONPATH"] to avoid failure in:
  _winapi.CreateProcess(): TypeError: environment can only contain str

tests/test_concurrency.py
tests/test_connection.py

index 2fc88c3172e7e64d4c517d28f8415eb410579b07..8dde58286b1b67d5bea62e5b77f9becd31e813f9 100644 (file)
@@ -94,7 +94,7 @@ t.join()
     with (tmpdir / "mptest.py").open("w") as f:
         f.write(module)
     env = dict(os.environ)
-    env["PYTHONPATH"] = tmpdir + os.pathsep + env.get("PYTHONPATH", "")
+    env["PYTHONPATH"] = str(tmpdir + os.pathsep + env.get("PYTHONPATH", ""))
     # TODO: debug this. Importing c module fails on travis in this scenario
     env.pop("PSYCOPG3_IMPL", None)
     out = sp.check_output(
index 24efbf50b5f1d1ad302dc5220710b0185eb2d0cb..91f84a4117a31246f78649bad61843c55b7a98d7 100644 (file)
@@ -1,4 +1,5 @@
 import gc
+import sys
 import time
 import socket
 import pytest
@@ -35,9 +36,10 @@ def test_connect_bad():
 
 @pytest.mark.slow
 @pytest.mark.xfail
+@pytest.mark.skipif(sys.platform == "win32", reason="connect() hangs on Win32")
 def test_connect_timeout():
     s = socket.socket(socket.AF_INET)
-    s.bind(("", 0))
+    s.bind(("localhost", 0))
     port = s.getsockname()[1]
     s.listen(0)