コード例 #1
0
 def test_named_mismatch_publish(self):
     with pubsub.subscribe("queuename") as event_source:
         pubsub.publish("data")
         try:
             data = event_source.get(False)
             assert False, "Should not have received data %s" % (data, )
         except Queue.Empty:
             assert True
コード例 #2
0
 def test_dropped_queue(self):
     with pubsub.subscribe() as event_source:
         pubsub.publish("data")
         self.assertEqual(1, event_source.qsize())
     with pubsub.subscribe() as event_source:
         self.assertEqual(0, event_source.qsize())
         try:
             data = event_source.get(False)
             assert False, "Should not have seen data %s" % (data, )
         except Queue.Empty:
             assert True
コード例 #3
0
ファイル: _utils.py プロジェクト: hufman/restful_rfcat
 def _set(self, state):
     """ Saves the given state to persistence """
     persistence.set(self._state_path(), state)
     pubsub.publish({'device': self, 'state': state})
コード例 #4
0
 def test_named_publish(self):
     with pubsub.subscribe("queuename") as event_source:
         pubsub.publish("data", topic="queuename")
         self.assertEqual("data", event_source.get(False))
コード例 #5
0
 def test_late_publish(self):
     with pubsub.subscribe("queuename") as event_source:
         self.assertEqual(0, event_source.qsize())
     pubsub.publish("data", topic="queuename")
     with pubsub.subscribe("queuename") as event_source:
         self.assertEqual(0, event_source.qsize())
コード例 #6
0
 def test_simple_publish(self):
     with pubsub.subscribe() as event_source:
         pubsub.publish("data")
         self.assertEqual("data", event_source.get(False))
コード例 #7
0
 def test_empty_publish(self):
     pubsub.publish("Data")