Coverage for tests/test_scheduled_downtime.py : 34%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
self.sdt = ScheduledDowntime()
self.assertEqual(downtime[0], night) self.assertEqual(downtime[1], duration) self.assertEqual(downtime[2], activity)
self.assertIsNone(self.sdt.downtime_file) self.assertEqual(len(self.sdt), 0)
self.sdt.initialize() self.assertEqual(os.path.basename(self.sdt.downtime_file), "scheduled_downtime.db") self.assertEqual(len(self.sdt), 31) self.check_downtime(self.sdt.downtimes[0], 158, 7, "general maintenance") self.check_downtime(self.sdt.downtimes[-1], 7242, 7, "general maintenance")
downtime_dbfile = "alternate_scheduled_downtime.db"
downtime_table = [] downtime_table.append("night INTEGER PRIMARY KEY") downtime_table.append("duration INTEGER") downtime_table.append("activity TEXT")
with sqlite3.connect(downtime_dbfile) as conn: cur = conn.cursor() cur.execute("DROP TABLE IF EXISTS Downtime") cur.execute("CREATE TABLE Downtime({})".format(",".join(downtime_table))) cur.execute("INSERT INTO Downtime VALUES(?, ?, ?)", (100, 7, "something to do")) cur.close()
self.sdt.initialize(downtime_dbfile) self.assertEqual(len(self.sdt), 1) self.check_downtime(self.sdt.downtimes[0], 100, 7, "something to do")
os.remove(downtime_dbfile)
self.sdt.initialize() self.check_downtime(self.sdt(), 158, 7, "general maintenance") self.assertEqual(len(self.sdt), 30)
lsst.utils.tests.init()
lsst.utils.tests.init() unittest.main() |