def test_resume_unack(self): q = SQLiteAckQueue(path=self.path) q.put("val1") val1 = q.get() self.assertEqual(q.empty(), True) self.assertEqual(q.qsize(), 0) self.assertEqual(q.unack_count(), 1) self.assertEqual(q.ready_count(), 0) del q q = SQLiteAckQueue(path=self.path, auto_resume=False) self.assertEqual(q.empty(), True) self.assertEqual(q.qsize(), 0) self.assertEqual(q.unack_count(), 1) self.assertEqual(q.ready_count(), 0) q.resume_unack_tasks() self.assertEqual(q.empty(), False) self.assertEqual(q.qsize(), 1) self.assertEqual(q.unack_count(), 0) self.assertEqual(q.ready_count(), 1) self.assertEqual(val1, q.get()) del q q = SQLiteAckQueue(path=self.path, auto_resume=True) self.assertEqual(q.empty(), False) self.assertEqual(q.qsize(), 1) self.assertEqual(q.unack_count(), 0) self.assertEqual(q.ready_count(), 1) self.assertEqual(val1, q.get())
def test_empty(self): q = SQLiteAckQueue(self.path, auto_commit=self.auto_commit) self.assertEqual(q.empty(), True) q.put('first') self.assertEqual(q.empty(), False) q.get() self.assertEqual(q.empty(), True)