Mercurial > p > roundup > code
comparison test/test_db.py @ 1375:faf93d3fbf2f
added mysql backend
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 13 Jan 2003 23:32:12 +0000 |
| parents | 4884fb0860f9 |
| children | 5d1fe5d51c12 |
comparison
equal
deleted
inserted
replaced
| 1374:8e4c3e8de96f | 1375:faf93d3fbf2f |
|---|---|
| 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_db.py,v 1.65 2003-01-12 23:53:20 richard Exp $ | 18 # $Id: test_db.py,v 1.66 2003-01-13 23:32:12 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, time | 20 import unittest, os, shutil, time |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, DatabaseError, Boolean, Number | 23 Interval, DatabaseError, Boolean, Number |
| 706 def setUp(self): | 706 def setUp(self): |
| 707 from roundup.backends import mysql | 707 from roundup.backends import mysql |
| 708 # remove previous test, ignore errors | 708 # remove previous test, ignore errors |
| 709 if os.path.exists(config.DATABASE): | 709 if os.path.exists(config.DATABASE): |
| 710 shutil.rmtree(config.DATABASE) | 710 shutil.rmtree(config.DATABASE) |
| 711 config.MYSQL_DATABASE='mysql@localhost root rootpasswd'.split() | 711 config.MYSQL_DATABASE = ('localhost', 'rounduptest', 'rounduptest', |
| 712 'rounduptest') | |
| 712 os.makedirs(config.DATABASE + '/files') | 713 os.makedirs(config.DATABASE + '/files') |
| 713 self.db = mysql.Database(config, 'admin') | 714 self.db = mysql.Database(config, 'admin') |
| 714 setupSchema(self.db, 1, mysql) | 715 setupSchema(self.db, 1, mysql) |
| 715 | 716 |
| 716 class mysqlReadOnlyDBTestCase(anydbmReadOnlyDBTestCase): | 717 class mysqlReadOnlyDBTestCase(anydbmReadOnlyDBTestCase): |
| 717 def setUp(self): | 718 def setUp(self): |
| 718 from roundup.backends import mysql | 719 from roundup.backends import mysql |
| 719 # remove previous test, ignore errors | 720 # remove previous test, ignore errors |
| 720 if os.path.exists(config.DATABASE): | 721 if os.path.exists(config.DATABASE): |
| 721 shutil.rmtree(config.DATABASE) | 722 shutil.rmtree(config.DATABASE) |
| 722 config.MYSQL_DATABASE='mysql@localhost root rootpasswd'.split() | 723 config.MYSQL_DATABASE = ('localhost', 'rounduptest', 'rounduptest', |
| 724 'rounduptest') | |
| 723 os.makedirs(config.DATABASE + '/files') | 725 os.makedirs(config.DATABASE + '/files') |
| 724 db = mysql.Database(config, 'admin') | 726 db = mysql.Database(config, 'admin') |
| 725 setupSchema(db, 1, mysql) | 727 setupSchema(db, 1, mysql) |
| 726 db.close() | 728 db.close() |
| 727 self.db = sqlite.Database(config) | 729 self.db = sqlite.Database(config) |
| 816 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') | 818 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') |
| 817 ] | 819 ] |
| 818 # return unittest.TestSuite(l) | 820 # return unittest.TestSuite(l) |
| 819 | 821 |
| 820 from roundup import backends | 822 from roundup import backends |
| 821 # if hasattr(backends, 'mysql'): | 823 if hasattr(backends, 'mysql'): |
| 822 # l.append(unittest.makeSuite(mysqlDBTestCase, 'test')) | 824 l.append(unittest.makeSuite(mysqlDBTestCase, 'test')) |
| 823 # l.append(unittest.makeSuite(mysqlReadOnlyDBTestCase, 'test')) | 825 l.append(unittest.makeSuite(mysqlReadOnlyDBTestCase, 'test')) |
| 824 # return unittest.TestSuite(l) | 826 # return unittest.TestSuite(l) |
| 825 | 827 |
| 826 if hasattr(backends, 'gadfly'): | 828 if hasattr(backends, 'gadfly'): |
| 827 l.append(unittest.makeSuite(gadflyDBTestCase, 'test')) | 829 l.append(unittest.makeSuite(gadflyDBTestCase, 'test')) |
| 828 l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) | 830 l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) |
