示例#1
0
    def tearDownClass(cls):
        # Get a connection to the database.
        db_conn = db.connect_loop()

        # Truncate the tables.
        db.truncate_table(db_conn=db_conn, table=ga.TRIPLEX_TABLE)
        db.truncate_table(db_conn=db_conn, table=ga.SUBSTATION_TABLE)

        try:
            # noinspection PyUnresolvedReferences
            os.remove(cls.out_file)
        except FileNotFoundError:
            pass

        try:
            os.remove('gridlabd.xml')
        except FileNotFoundError:
            pass
示例#2
0
文件: test_db.py 项目: shpoudel/pyvvo
 def setUpClass(cls):
     cls.conn = db.connect_loop()
示例#3
0
文件: test_db.py 项目: shpoudel/pyvvo
 def test_bad_db(self):
     copy = os.environ.copy()
     copy['DB_DB'] = 'some_database'
     with patch.dict('os.environ', copy, clear=True):
         with self.assertRaises(Error):
             db.connect_loop(timeout=0.01, retry_interval=0.01)
示例#4
0
文件: test_db.py 项目: shpoudel/pyvvo
 def test_bad_port(self):
     copy = os.environ.copy()
     copy['DB_PORT'] = '1234'
     with patch.dict('os.environ', copy, clear=True):
         with self.assertRaises(Error):
             db.connect_loop(timeout=0.01, retry_interval=0.01)
示例#5
0
文件: test_db.py 项目: shpoudel/pyvvo
 def test_works(self):
     """This should work out of the box."""
     c = db.connect_loop()
     self.assertIsInstance(c, Connection)