]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Allow running tests with psycopg-pool 3.1
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 5 Feb 2022 19:15:48 +0000 (20:15 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 5 Feb 2022 19:15:48 +0000 (20:15 +0100)
A few internal attributes changed but they are only poked at for
testing, they are not part of the interface.

tests/pool/test_pool.py
tests/pool/test_pool_async.py

index 18b36e1afeb93a3b845f7a25a46a1640ef8466a0..d8bcc022fdbaad772d2e037a6f997ad0d27c659d 100644 (file)
@@ -560,9 +560,9 @@ def test_close_no_threads(dsn):
         assert t.is_alive()
 
     p.close()
-    assert not p._sched_runner.is_alive()
+    assert not (p._sched_runner and p._sched_runner.is_alive())
     for t in p._workers:
-        assert not t.is_alive()
+        assert not (t and t.is_alive())
 
 
 def test_putconn_no_pool(dsn):
index e6748874bfc96a4691d7853607aeb7ea5c7812ab..22692c320122afed08fc4b0a22928530ac7faaf4 100644 (file)
@@ -545,7 +545,7 @@ async def test_close_no_tasks(dsn):
         assert not t.done()
 
     await p.close()
-    assert p._sched_runner.done()
+    assert not p._sched_runner or p._sched_runner.done()
     for t in p._workers:
         assert t.done()