diff idavoll/test/test_storage.py @ 219:bb7103da9879

Make the PostgreSQL ConnectionPool only once for all unit tests. Author: ralphm. Fixes: #18.
author Ralph Meijer <ralphm@ik.nu>
date Sat, 16 Oct 2010 20:02:47 +0200
parents 274a45d2a5ab
children a430976f2977
line wrap: on
line diff
--- a/idavoll/test/test_storage.py	Wed Oct 14 16:13:24 2009 +0000
+++ b/idavoll/test/test_storage.py	Sat Oct 16 20:02:47 2010 +0200
@@ -11,8 +11,6 @@
 from twisted.internet import defer
 from twisted.words.xish import domish
 
-from wokkel import pubsub
-
 from idavoll import error, iidavoll
 
 OWNER = jid.JID('owner@example.com')
@@ -447,10 +445,13 @@
 
 class PgsqlStorageStorageTestCase(unittest.TestCase, StorageTests):
 
+    dbpool = None
+
     def setUp(self):
         from idavoll.pgsql_storage import Storage
         from twisted.enterprise import adbapi
-        self.dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL',
+        if self.dbpool is None:
+            self.__class__.dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL',
                                             database='pubsub_test',
                                             cp_reconnect=True,
                                             client_encoding='utf-8',