示例#1
0
文件: test_hub.py 项目: jesper/kombu
 def test_is_in_blocking_section_with_loop(self):
     hub = Hub()
     set_event_loop(hub)
     self.assertFalse(is_in_blocking_section())
     with maybe_block():
         self.assertTrue(is_in_blocking_section())
     self.assertFalse(is_in_blocking_section())
示例#2
0
    def heartbeat_check(self, rate=2):
        """Verify that heartbeats are sent and received.

        If the current transport does not support heartbeats then
        this is a noop operation.

        :keyword rate: Rate is how often the tick is called
            compared to the actual heartbeat value.  E.g. if
            the heartbeat is set to 3 seconds, and the tick
            is called every 3 / 2 seconds, then the rate is 2.

        """
        if not is_in_blocking_section():
            return self.transport.heartbeat_check(self.connection, rate=rate)
示例#3
0
文件: test_hub.py 项目: jesper/kombu
 def test_is_in_blocking_section_without_loop(self):
     set_event_loop(None)
     self.assertFalse(is_in_blocking_section())