]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Print the unexpected warnings in tests
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 2 Oct 2021 19:23:51 +0000 (21:23 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 4 Oct 2021 12:45:16 +0000 (14:45 +0200)
tests/pool/test_pool.py
tests/test_connection.py
tests/test_connection_async.py

index 5700d458cb9190708f83708fe1e36011bcd04eac..6c0f9374d839a37507c581f60319f05bd6d57e25 100644 (file)
@@ -573,7 +573,7 @@ def test_del_no_warning(dsn, recwarn):
     ref = weakref.ref(p)
     del p
     assert not ref()
-    assert not recwarn
+    assert not recwarn, [str(w.message) for w in recwarn.list]
 
 
 @pytest.mark.slow
index 3e7070182ecf2ad7d8331af9dc4f88c1bff25777..7faae5dd4a4cc7fe6a910a6557a7cc793104603c 100644 (file)
@@ -93,7 +93,7 @@ def test_connection_warn_close(dsn, recwarn):
     conn = Connection.connect(dsn)
     conn.close()
     del conn
-    assert not recwarn
+    assert not recwarn, [str(w.message) for w in recwarn.list]
 
     conn = Connection.connect(dsn)
     del conn
@@ -115,7 +115,7 @@ def test_connection_warn_close(dsn, recwarn):
     with Connection.connect(dsn) as conn:
         pass
     del conn
-    assert not recwarn
+    assert not recwarn, [str(w.message) for w in recwarn.list]
 
 
 def test_context_commit(conn, dsn):
index 2db77fc964867f9d60836196754f7e360d380360..f6be5f4638b22ff04096863878667714d62016f4 100644 (file)
@@ -100,7 +100,7 @@ async def test_connection_warn_close(dsn, recwarn):
     conn = await AsyncConnection.connect(dsn)
     await conn.close()
     del conn
-    assert not recwarn
+    assert not recwarn, [str(w.message) for w in recwarn.list]
 
     conn = await AsyncConnection.connect(dsn)
     del conn
@@ -122,7 +122,7 @@ async def test_connection_warn_close(dsn, recwarn):
     async with await AsyncConnection.connect(dsn) as conn:
         pass
     del conn
-    assert not recwarn
+    assert not recwarn, [str(w.message) for w in recwarn.list]
 
 
 async def test_context_commit(aconn, dsn):