]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Give a gc hit before running gc tests
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 29 Jun 2021 00:22:18 +0000 (01:22 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 29 Jun 2021 00:23:41 +0000 (01:23 +0100)
Sometimes these tests fail because there is garbage before.

tests/test_copy.py
tests/test_copy_async.py
tests/test_cursor.py
tests/test_cursor_async.py

index b62097a728ce6138e04c48cc04f94df820439fd1..dabb8aafb91e47286d7595f2111df65062462cef 100644 (file)
@@ -537,6 +537,7 @@ def test_copy_to_leaks(dsn, faker, fmt, method, retries):
                     elif method == "rows":
                         list(copy.rows())
 
+    gc_collect()
     for retry in retries:
         with retry:
             n = []
@@ -578,6 +579,7 @@ def test_copy_from_leaks(dsn, faker, fmt, retries):
                 for got, want in zip(recs, faker.records):
                     faker.assert_record(got, want)
 
+    gc_collect()
     for retry in retries:
         with retry:
             n = []
index c34286e78e0e5c046f2bdbb5bc5f320a5a80d5bd..e0f7ce9e162f1901d4ead593bdeca388325f4925 100644 (file)
@@ -515,6 +515,7 @@ async def test_copy_to_leaks(dsn, faker, fmt, method, retries):
                         async for x in copy.rows():
                             pass
 
+    gc_collect()
     async for retry in retries:
         with retry:
             n = []
@@ -556,6 +557,7 @@ async def test_copy_from_leaks(dsn, faker, fmt, retries):
                 for got, want in zip(recs, faker.records):
                     faker.assert_record(got, want)
 
+    gc_collect()
     async for retry in retries:
         with retry:
             n = []
index 49e3f23136906719fa4c36b1ebd3abe7e79443c0..e575867fd7b12423cee3be40aa8f0e569ee7f10e 100644 (file)
@@ -550,6 +550,7 @@ def test_leak(dsn, faker, fmt, fmt_out, fetch, row_factory):
     row_factory = getattr(rows, row_factory)
 
     n = []
+    gc_collect()
     for i in range(3):
         with psycopg.connect(dsn) as conn:
             with conn.cursor(binary=fmt_out, row_factory=row_factory) as cur:
index 3a206861bf3e70f404e52cdd0522809bfb3f06b0..9d80b269884e8a8e844c6933e32e73d1d5eecd37 100644 (file)
@@ -464,6 +464,7 @@ async def test_leak(dsn, faker, fmt, fmt_out, fetch, row_factory):
     row_factory = getattr(rows, row_factory)
 
     n = []
+    gc_collect()
     for i in range(3):
         async with await psycopg.AsyncConnection.connect(dsn) as conn:
             async with conn.cursor(