Mercurial > p > roundup > code
diff test/test_postgresql.py @ 2856:adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 03 Nov 2004 01:34:21 +0000 |
| parents | 93c58a68061b |
| children | 4d9adb8bc3b1 |
line wrap: on
line diff
--- a/test/test_postgresql.py Wed Nov 03 01:10:53 2004 +0000 +++ b/test/test_postgresql.py Wed Nov 03 01:34:21 2004 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: test_postgresql.py,v 1.11 2004-09-25 15:50:36 a1s Exp $ +# $Id: test_postgresql.py,v 1.12 2004-11-03 01:34:21 richard Exp $ import unittest @@ -23,15 +23,13 @@ from db_test_base import DBTest, ROTest, config, SchemaTest, ClassicInitTest -from roundup import backends +from roundup.backends import get_backend, have_backend class postgresqlOpener: - if hasattr(backends, 'postgresql'): - from roundup.backends import postgresql as module + if have_backend('postgresql'): + module = get_backend('postgresql') def setUp(self): - #from roundup.backends.back_postgresql import db_nuke - #db_nuke(config, 1) pass def tearDown(self): @@ -39,8 +37,7 @@ def nuke_database(self): # clear out the database - easiest way is to nuke and re-create it - from roundup.backends.back_postgresql import db_nuke - db_nuke(config) + self.module.db_nuke(config) class postgresqlDBTest(postgresqlOpener, DBTest): def setUp(self): @@ -99,14 +96,13 @@ def test_suite(): suite = unittest.TestSuite() - if not hasattr(backends, 'postgresql'): + if not have_backend('postgresql'): print "Skipping postgresql tests" return suite # make sure we start with a clean slate - from roundup.backends.back_postgresql import db_nuke, db_exists - if db_exists(config): - db_nuke(config, 1) + if postgresqlOpener.module.db_exists(config): + postgresqlOpener.module.db_nuke(config, 1) # TODO: Check if we can run postgresql tests print 'Including postgresql tests'
