def test_timeout(self): copool.add(self.__set_buffer, funcid="test", timeout=100) copool.pause("test") copool.resume("test") copool.remove("test") with pytest.raises(ValueError): copool.step("test")
def test_pause_resume(self): copool.add(self.__set_buffer) self._assert_eventually(True) copool.pause(self.__set_buffer) self.buffer = None self._assert_never(True) copool.resume(self.__set_buffer) self._assert_eventually(True) copool.remove(self.__set_buffer) self.buffer = None self._assert_never(True)
def test_pause_resume_with_funcid(self): self.buffer = None copool.add(self.__set_buffer, funcid="test") self._assert_eventually(True) copool.pause("test") self.buffer = None self._assert_never(True) copool.resume("test") copool.resume("test") self._assert_eventually(True) copool.remove("test") self.buffer = None self._assert_never(True)
def test_pause_resume_with_funcid(self): copool.add(self.__set_buffer, funcid="test") gtk.main_iteration(block=False) gtk.main_iteration(block=False) copool.pause("test") self.buffer = None gtk.main_iteration(block=False) gtk.main_iteration(block=False) self.assertEquals(self.buffer, None) copool.resume("test") gtk.main_iteration(block=False) gtk.main_iteration(block=False) self.assertEquals(self.buffer, True) copool.remove("test") self.buffer = None gtk.main_iteration(block=False) gtk.main_iteration(block=False)
def test_pause_resume(self): copool.add(self.__set_buffer) Gtk.main_iteration_do(False) Gtk.main_iteration_do(False) copool.pause(self.__set_buffer) self.buffer = None Gtk.main_iteration_do(False) Gtk.main_iteration_do(False) self.assertEquals(self.buffer, None) copool.resume(self.__set_buffer) Gtk.main_iteration_do(False) Gtk.main_iteration_do(False) self.assertEquals(self.buffer, True) copool.remove(self.__set_buffer) self.buffer = None Gtk.main_iteration_do(False) Gtk.main_iteration_do(False)
def pause_func(state): if state != self._paused: if state: copool.pause(funcid) else: copool.resume(funcid)
def test_timeout(self): copool.add(self.__set_buffer, funcid="test", timeout=100) copool.pause("test") copool.resume("test") copool.remove("test") self.assertRaises(ValueError, copool.step, "test")