[server/test] don't leak timeout from one test class to the next
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 03 Nov 2015 18:03:21 +0100
changeset 10812 a747e211266b
parent 10811 5a1b4361a797
child 10813 ab626726a70a
[server/test] don't leak timeout from one test class to the next Reset SQL_CONNECT_HOOKS after we're done with this test class so the next one doesn't inherit a timeout it doesn't want.
server/test/unittest_postgres.py
--- a/server/test/unittest_postgres.py	Fri Oct 16 12:22:48 2015 +0200
+++ b/server/test/unittest_postgres.py	Tue Nov 03 18:03:21 2015 +0100
@@ -23,6 +23,7 @@
 
 from logilab.common.testlib import SkipTest
 
+import logilab.database as lgdb
 from cubicweb import ValidationError
 from cubicweb.devtools import PostgresApptestConfiguration, startpgcluster, stoppgcluster
 from cubicweb.devtools.testlib import CubicWebTC
@@ -51,6 +52,14 @@
 class PostgresFTITC(CubicWebTC):
     configcls = PostgresTimeoutConfiguration
 
+    @classmethod
+    def setUpClass(cls):
+        cls.orig_connect_hooks = lgdb.SQL_CONNECT_HOOKS['postgres'][:]
+
+    @classmethod
+    def tearDownClass(cls):
+        lgdb.SQL_CONNECT_HOOKS['postgres'] = cls.orig_connect_hooks
+
     def test_eid_range(self):
         # concurrent allocation of eid ranges
         source = self.session.repo.sources_by_uri['system']