[Psycopg] [PATCH] lobject test failures

Menno Smits menno at freshfoo.com
Wed Apr 1 17:59:55 CEST 2009


Hi,

I noticed on my PC at work that many test failures were occurring in the
lobject tests. With both 2.0.8 and 2.0.9 I see many failures similar to
the following:

======================================================================
ERROR: test_write_after_commit (test_lobject.LargeObjectTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/home/msmits/downloads/psycopg2-2.0.9-orig/tests/test_lobject.py", line
14, in setUp
    self.conn = psycopg2.connect(tests.dsn)
OperationalError: FATAL:  connection limit exceeded for non-superusers


It seems the max number of connections allowed on with the postgresql on
my work PC is quite low and the lobject tests were not to close
connections after each test. The following trivial patch fixes the problem:

diff -aur psycopg2-2.0.9-orig/tests/test_lobject.py
psycopg2-2.0.9-lobject/tests/test_lobject.py
--- psycopg2-2.0.9-orig/tests/test_lobject.py   2008-05-06
22:55:34.000000000 +0100
+++ psycopg2-2.0.9-lobject/tests/test_lobject.py        2009-04-01
16:09:54.841369474 +0100
@@ -26,6 +26,7 @@
                 pass
             else:
                 lo.unlink()
+        self.conn.close()

     def test_create(self):
         lo = self.conn.lobject()


It's interesting that the connections are not closed when they are
garbage collected. I'm guessing this is due to connection pooling?

I've found

Regards,
Menno


More information about the Psycopg mailing list