예제 #1
0
class DbPkgMixin(object):
    def setUp(self):
        pkgnm = 'testdbpkg'
        self.package = DBPackage(pkgnm)
        self.package.root_gvar = 'db_pkg_root'
        self.assertIsNone(self.package.fetch_global_val(self.package.root_gvar))
        self.assertEqual(self.package.name, pkgnm)
        self.package.db.config_folder = os.path.join(self.package.get_root_dir(), 'config')



    def tearDown(self):
        base = self.package.fetch_global_val('Base')
        engine = self.package.fetch_global_val('engine')
        metadata = self.package.fetch_global_val('metadata')
        self.assertIsInstance(metadata, MetaData)
        self.assertEqual(base.metadata, metadata)
        self.assertEqual(base.metadata.bind, engine)

        def cleanUp():
            global db_pkg_root, engine, metadata, session
            db_pkg_root = engine = metadata = session = None
            delattr(self, 'package')

        self.addCleanup(cleanUp)
        self.doCleanups()
예제 #2
0
 def setUp(self):
     pkgnm = 'testdbpkg'
     self.package = DBPackage(pkgnm)
     self.package.root_gvar = 'db_pkg_root'
     self.assertIsNone(self.package.fetch_global_val(self.package.root_gvar))
     self.assertEqual(self.package.name, pkgnm)
     self.package.db.config_folder = os.path.join(self.package.get_root_dir(), 'config')