Beispiel #1
0
 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())
Beispiel #2
0
 def test_get_set_event_loop(self):
     set_event_loop(None)
     self.assertIsNone(_hub._current_loop)
     self.assertIsNone(get_event_loop())
     hub = Hub()
     set_event_loop(hub)
     self.assertIs(_hub._current_loop, hub)
     self.assertIs(get_event_loop(), hub)
 def test_get_set_event_loop(self):
     set_event_loop(None)
     self.assertIsNone(_hub._current_loop)
     self.assertIsNone(get_event_loop())
     hub = Hub()
     set_event_loop(hub)
     self.assertIs(_hub._current_loop, hub)
     self.assertIs(get_event_loop(), hub)
Beispiel #4
0
 def test_get_set_event_loop(self):
     set_event_loop(None)
     assert _hub._current_loop is None
     assert get_event_loop() is None
     hub = Hub()
     set_event_loop(hub)
     assert _hub._current_loop is hub
     assert get_event_loop() is hub
Beispiel #5
0
 def test_get_set_event_loop(self):
     set_event_loop(None)
     assert _hub._current_loop is None
     assert get_event_loop() is None
     hub = Hub()
     set_event_loop(hub)
     assert _hub._current_loop is hub
     assert get_event_loop() is hub
Beispiel #6
0
 def teardown(self):
     set_event_loop(self._prev_loop)
 def teardown(self):
     set_event_loop(self._prev_loop)
Beispiel #8
0
 def test_is_in_blocking_section_without_loop(self):
     set_event_loop(None)
     self.assertFalse(is_in_blocking_section())
Beispiel #9
0
 def test_maybe_block_with_loop(self):
     hub = ContextMock(name='hub')
     set_event_loop(hub)
     with maybe_block():
         pass
     hub.maybe_block.assert_called_with()
Beispiel #10
0
 def test_maybe_block_without_loop(self):
     set_event_loop(None)
     with maybe_block():
         pass