Mercurial > p > roundup > code
comparison test/test_postgresql.py @ 2107:b7404a96b58a 0.7.0b1
minor pre-release / test fixes
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 24 Mar 2004 06:18:59 +0000 |
| parents | c091cacdc505 |
| children | f5755353e972 |
comparison
equal
deleted
inserted
replaced
| 2106:12a902ea1dcd | 2107:b7404a96b58a |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: test_postgresql.py,v 1.6 2004-03-18 01:58:46 richard Exp $ | 18 # $Id: test_postgresql.py,v 1.7 2004-03-24 06:18:59 richard Exp $ |
| 19 | 19 |
| 20 import unittest | 20 import unittest |
| 21 | 21 |
| 22 from roundup.hyperdb import DatabaseError | 22 from roundup.hyperdb import DatabaseError |
| 23 | 23 |
| 26 # Postgresql connection data | 26 # Postgresql connection data |
| 27 # NOTE: THIS MUST BE A LOCAL DATABASE | 27 # NOTE: THIS MUST BE A LOCAL DATABASE |
| 28 config.POSTGRESQL_DATABASE = {'database': 'rounduptest'} | 28 config.POSTGRESQL_DATABASE = {'database': 'rounduptest'} |
| 29 | 29 |
| 30 from roundup import backends | 30 from roundup import backends |
| 31 from roundup.backends.back_postgresql import db_nuke, db_create, db_exists | |
| 32 | 31 |
| 33 class postgresqlOpener: | 32 class postgresqlOpener: |
| 34 if hasattr(backends, 'postgresql'): | 33 if hasattr(backends, 'postgresql'): |
| 35 from roundup.backends import postgresql as module | 34 from roundup.backends import postgresql as module |
| 36 | 35 |
| 37 def setUp(self): | 36 def setUp(self): |
| 37 #from roundup.backends.back_postgresql import db_nuke | |
| 38 #db_nuke(config, 1) | 38 #db_nuke(config, 1) |
| 39 pass | 39 pass |
| 40 | 40 |
| 41 def tearDown(self): | 41 def tearDown(self): |
| 42 self.nuke_database() | 42 self.nuke_database() |
| 43 | 43 |
| 44 def nuke_database(self): | 44 def nuke_database(self): |
| 45 # clear out the database - easiest way is to nuke and re-create it | 45 # clear out the database - easiest way is to nuke and re-create it |
| 46 from roundup.backends.back_postgresql import db_nuke | |
| 46 db_nuke(config) | 47 db_nuke(config) |
| 47 | 48 |
| 48 class postgresqlDBTest(postgresqlOpener, DBTest): | 49 class postgresqlDBTest(postgresqlOpener, DBTest): |
| 49 def setUp(self): | 50 def setUp(self): |
| 50 postgresqlOpener.setUp(self) | 51 postgresqlOpener.setUp(self) |
| 102 postgresqlOpener.tearDown(self) | 103 postgresqlOpener.tearDown(self) |
| 103 | 104 |
| 104 def test_suite(): | 105 def test_suite(): |
| 105 suite = unittest.TestSuite() | 106 suite = unittest.TestSuite() |
| 106 if not hasattr(backends, 'postgresql'): | 107 if not hasattr(backends, 'postgresql'): |
| 108 print "Skipping mysql tests" | |
| 107 return suite | 109 return suite |
| 108 | 110 |
| 109 # make sure we start with a clean slate | 111 # make sure we start with a clean slate |
| 112 from roundup.backends.back_postgresql import db_nuke | |
| 110 db_nuke(config, 1) | 113 db_nuke(config, 1) |
| 111 | 114 |
| 112 # TODO: Check if we can run postgresql tests | 115 # TODO: Check if we can run postgresql tests |
| 113 print 'Including postgresql tests' | 116 print 'Including postgresql tests' |
| 114 suite.addTest(unittest.makeSuite(postgresqlDBTest)) | 117 suite.addTest(unittest.makeSuite(postgresqlDBTest)) |
