site.addsitedir(os.path.dirname(os.path.abspath(sys.argv[0])) + '/../src')
import unittest
+import Census
from Tests.Unit import CensusTest
from Tests.Unit import DistributionTest
from Tests.Unit import FileUtilsTest
suite.addTest(UniformDistributionTest.suite())
suite.addTest(DistributionTest.suite())
unittest.TextTestRunner(verbosity=2).run(suite)
+
+try:
+ # The Census.Database initialization will raise an exception
+ # if the database cannot be accessed.
+ cdb = Census.Database()
+ db_suite = unittest.TestSuite()
+ db_suite.addTest(CensusTest.db_suite())
+ unittest.TextTestRunner(verbosity=2).run(db_suite)
+except:
+ pass
def suite():
+ # Tests that don't hit the database.
suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(DatabaseTest))
return suite
-
+
+
+def db_suite():
+ # The tests that hit the database.
+ db_suite = unittest.TestSuite()
+ db_suite.addTest(unittest.makeSuite(DatabaseTest))
+ return db_suite