예제 #1
0
    def setUp(self):
        super(Database, self).setUp()

        if self.sql_connection == "sqlite://":
            conn = self.engine.connect()
            conn.connection.executescript(self._DB)
            self.addCleanup(self.engine.dispose)
        else:
            shutil.copyfile(paths.state_path_rel(self.sqlite_clean_db),
                            paths.state_path_rel(self.sqlite_db))
            self.addCleanup(os.unlink, paths.state_path_rel(self.sqlite_db))
예제 #2
0
파일: base.py 프로젝트: lfntac/ipv6
    def setUp(self):
        super(Database, self).setUp()

        if self.sql_connection == "sqlite://":
            conn = self.engine.connect()
            conn.connection.executescript(self._DB)
            self.addCleanup(self.engine.dispose)
        else:
            try:
                shutil.copyfile(paths.state_path_rel(self.sqlite_clean_db),
                                paths.state_path_rel(self.sqlite_db))
            except Exception:
                pass
예제 #3
0
 def __init__(self, db_api, sql_connection,
              sqlite_db, sqlite_clean_db):
     self.sql_connection = sql_connection
     self.sqlite_db = sqlite_db
     self.sqlite_clean_db = sqlite_clean_db
     self.engine = db_api.get_engine()
     self.engine.dispose()
     conn = self.engine.connect()
     if sql_connection == "sqlite://":
         self.setup_sqlite()
     elif sql_connection.startswith('sqlite:///'):
         testdb = paths.state_path_rel(sqlite_db)
         self.setup_sqlite()
     self.post_migrations()
     if sql_connection == "sqlite://":
         conn = self.engine.connect()
         self._DB = "".join(line for line in conn.connection.iterdump())
         self.engine.dispose()
     else:
         cleandb = paths.state_path_rel(sqlite_clean_db)
         shutil.copyfile(testdb, cleandb)
예제 #4
0
파일: base.py 프로젝트: lfntac/ipv6
 def __init__(self, db_api, sql_connection,
              sqlite_db, sqlite_clean_db):
     self.sql_connection = sql_connection
     self.sqlite_db = sqlite_db
     self.sqlite_clean_db = sqlite_clean_db
     self.engine = db_api.get_engine()
     self.engine.dispose()
     conn = self.engine.connect()
     if sql_connection == "sqlite://":
         self.setup_sqlite()
     elif sql_connection.startswith('sqlite:///'):
         testdb = paths.state_path_rel(sqlite_db)
         self.setup_sqlite()
     self.post_migrations()
     if sql_connection == "sqlite://":
         conn = self.engine.connect()
         self._DB = "".join(line for line in conn.connection.iterdump())
         self.engine.dispose()
     else:
         cleandb = paths.state_path_rel(sqlite_clean_db)
         try:
             shutil.copyfile(testdb, cleandb)
         except Exception:
             pass