Mercurial > p > roundup > code
comparison test/test_db.py @ 1165:14467c765167
sqlite backend!
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 18 Sep 2002 05:07:49 +0000 |
| parents | d0da32fbdedc |
| children | 94620e088e3a |
comparison
equal
deleted
inserted
replaced
| 1164:e2b5f02cefe3 | 1165:14467c765167 |
|---|---|
| 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.47 2002-09-16 08:04:46 richard Exp $ | 18 # $Id: test_db.py,v 1.48 2002-09-18 05:07:48 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 |
| 588 setupSchema(db, 1, gadfly) | 588 setupSchema(db, 1, gadfly) |
| 589 self.db = gadfly.Database(config) | 589 self.db = gadfly.Database(config) |
| 590 setupSchema(self.db, 0, gadfly) | 590 setupSchema(self.db, 0, gadfly) |
| 591 | 591 |
| 592 | 592 |
| 593 class sqliteDBTestCase(anydbmDBTestCase): | |
| 594 def setUp(self): | |
| 595 from roundup.backends import sqlite | |
| 596 # remove previous test, ignore errors | |
| 597 if os.path.exists(config.DATABASE): | |
| 598 shutil.rmtree(config.DATABASE) | |
| 599 os.makedirs(config.DATABASE + '/files') | |
| 600 self.db = sqlite.Database(config, 'test') | |
| 601 setupSchema(self.db, 1, sqlite) | |
| 602 | |
| 603 def testIDGeneration(self): | |
| 604 pass | |
| 605 | |
| 606 class sqliteReadOnlyDBTestCase(anydbmReadOnlyDBTestCase): | |
| 607 def setUp(self): | |
| 608 from roundup.backends import sqlite | |
| 609 # remove previous test, ignore errors | |
| 610 if os.path.exists(config.DATABASE): | |
| 611 shutil.rmtree(config.DATABASE) | |
| 612 os.makedirs(config.DATABASE + '/files') | |
| 613 db = sqlite.Database(config, 'test') | |
| 614 setupSchema(db, 1, sqlite) | |
| 615 self.db = sqlite.Database(config) | |
| 616 setupSchema(self.db, 0, sqlite) | |
| 617 | |
| 618 | |
| 593 class metakitDBTestCase(anydbmDBTestCase): | 619 class metakitDBTestCase(anydbmDBTestCase): |
| 594 def setUp(self): | 620 def setUp(self): |
| 595 from roundup.backends import metakit | 621 from roundup.backends import metakit |
| 596 import weakref | 622 import weakref |
| 597 metakit._instances = weakref.WeakValueDictionary() | 623 metakit._instances = weakref.WeakValueDictionary() |
| 677 l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) | 703 l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) |
| 678 except: | 704 except: |
| 679 print 'gadfly module not found, skipping gadfly DBTestCase' | 705 print 'gadfly module not found, skipping gadfly DBTestCase' |
| 680 | 706 |
| 681 try: | 707 try: |
| 708 import sqlite | |
| 709 l.append(unittest.makeSuite(sqliteDBTestCase, 'test')) | |
| 710 l.append(unittest.makeSuite(sqliteReadOnlyDBTestCase, 'test')) | |
| 711 except: | |
| 712 print 'sqlite module not found, skipping gadfly DBTestCase' | |
| 713 | |
| 714 try: | |
| 682 import metakit | 715 import metakit |
| 683 l.append(unittest.makeSuite(metakitDBTestCase, 'test')) | 716 l.append(unittest.makeSuite(metakitDBTestCase, 'test')) |
| 684 l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test')) | 717 l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test')) |
| 685 except: | 718 except: |
| 686 print 'metakit module not found, skipping metakit DBTestCase' | 719 print 'metakit module not found, skipping metakit DBTestCase' |
