|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: test_postgresql.py,v 1.11 2004-09-25 15:50:36 a1s Exp $ |
| 18 | +# $Id: test_postgresql.py,v 1.12 2004-11-03 01:34:21 richard Exp $ |
19 | 19 |
|
20 | 20 | import unittest |
21 | 21 |
|
22 | 22 | from roundup.hyperdb import DatabaseError |
23 | 23 |
|
24 | 24 | from db_test_base import DBTest, ROTest, config, SchemaTest, ClassicInitTest |
25 | 25 |
|
26 | | -from roundup import backends |
| 26 | +from roundup.backends import get_backend, have_backend |
27 | 27 |
|
28 | 28 | class postgresqlOpener: |
29 | | - if hasattr(backends, 'postgresql'): |
30 | | - from roundup.backends import postgresql as module |
| 29 | + if have_backend('postgresql'): |
| 30 | + module = get_backend('postgresql') |
31 | 31 |
|
32 | 32 | def setUp(self): |
33 | | - #from roundup.backends.back_postgresql import db_nuke |
34 | | - #db_nuke(config, 1) |
35 | 33 | pass |
36 | 34 |
|
37 | 35 | def tearDown(self): |
38 | 36 | self.nuke_database() |
39 | 37 |
|
40 | 38 | def nuke_database(self): |
41 | 39 | # clear out the database - easiest way is to nuke and re-create it |
42 | | - from roundup.backends.back_postgresql import db_nuke |
43 | | - db_nuke(config) |
| 40 | + self.module.db_nuke(config) |
44 | 41 |
|
45 | 42 | class postgresqlDBTest(postgresqlOpener, DBTest): |
46 | 43 | def setUp(self): |
@@ -99,14 +96,13 @@ def tearDown(self): |
99 | 96 |
|
100 | 97 | def test_suite(): |
101 | 98 | suite = unittest.TestSuite() |
102 | | - if not hasattr(backends, 'postgresql'): |
| 99 | + if not have_backend('postgresql'): |
103 | 100 | print "Skipping postgresql tests" |
104 | 101 | return suite |
105 | 102 |
|
106 | 103 | # make sure we start with a clean slate |
107 | | - from roundup.backends.back_postgresql import db_nuke, db_exists |
108 | | - if db_exists(config): |
109 | | - db_nuke(config, 1) |
| 104 | + if postgresqlOpener.module.db_exists(config): |
| 105 | + postgresqlOpener.module.db_nuke(config, 1) |
110 | 106 |
|
111 | 107 | # TODO: Check if we can run postgresql tests |
112 | 108 | print 'Including postgresql tests' |
|
0 commit comments