]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix(test): wait for thread end before reading process stdout
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 21 May 2025 09:34:50 +0000 (11:34 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 21 May 2025 09:34:50 +0000 (11:34 +0200)
Should solve what seems a race condition on PyPy and free-threaded
Python (see #1096).

tests/test_concurrency.py

index 4b5b760c8731a82af2658b6cb5fb6285e42043c8..0fe8f3f37a55fa7b2f84a3769fc423f53d1f2664 100644 (file)
@@ -558,10 +558,10 @@ def test_break_attempts(dsn, proxy):
         proc.send_signal(signal.SIGINT)
         proc.wait()
         t1 = time.time()
+        t.join()
 
     # Check that we didn't try the second attempt
     assert t1 - t0 < 2.5
     assert proc.returncode != 0
-    if sys.implementation.name != "pypy":  # unexpected, but hey.
-        assert "KeyboardInterrupt" in stderr
+    assert "KeyboardInterrupt" in stderr
     assert stdout == ""