Mercurial > libervia-pubsub
comparison 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 |
comparison
equal
deleted
inserted
replaced
218:479fc959af0e | 219:bb7103da9879 |
---|---|
8 from zope.interface.verify import verifyObject | 8 from zope.interface.verify import verifyObject |
9 from twisted.trial import unittest | 9 from twisted.trial import unittest |
10 from twisted.words.protocols.jabber import jid | 10 from twisted.words.protocols.jabber import jid |
11 from twisted.internet import defer | 11 from twisted.internet import defer |
12 from twisted.words.xish import domish | 12 from twisted.words.xish import domish |
13 | |
14 from wokkel import pubsub | |
15 | 13 |
16 from idavoll import error, iidavoll | 14 from idavoll import error, iidavoll |
17 | 15 |
18 OWNER = jid.JID('owner@example.com') | 16 OWNER = jid.JID('owner@example.com') |
19 SUBSCRIBER = jid.JID('subscriber@example.com/Home') | 17 SUBSCRIBER = jid.JID('subscriber@example.com/Home') |
445 | 443 |
446 | 444 |
447 | 445 |
448 class PgsqlStorageStorageTestCase(unittest.TestCase, StorageTests): | 446 class PgsqlStorageStorageTestCase(unittest.TestCase, StorageTests): |
449 | 447 |
448 dbpool = None | |
449 | |
450 def setUp(self): | 450 def setUp(self): |
451 from idavoll.pgsql_storage import Storage | 451 from idavoll.pgsql_storage import Storage |
452 from twisted.enterprise import adbapi | 452 from twisted.enterprise import adbapi |
453 self.dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL', | 453 if self.dbpool is None: |
454 self.__class__.dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL', | |
454 database='pubsub_test', | 455 database='pubsub_test', |
455 cp_reconnect=True, | 456 cp_reconnect=True, |
456 client_encoding='utf-8', | 457 client_encoding='utf-8', |
457 ) | 458 ) |
458 self.s = Storage(self.dbpool) | 459 self.s = Storage(self.dbpool) |