def test_step(self): copool.add(self.__set_buffer, funcid="test") copool.pause("test") self.assertTrue(copool.step("test")) self.go = False self.assertFalse(copool.step("test")) self.assertRaises(ValueError, copool.step, "test")
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_step(self): copool.add(self.__set_buffer, funcid="test") copool.pause("test") assert copool.step("test") self.go = False assert not copool.step("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_restart_pause(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.add(self.__set_buffer, funcid="test") self._assert_eventually(True) copool.pause("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 test_pause_restart_pause(self): copool.add(self.__set_buffer, funcid="test") gtk.main_iteration(block=False) gtk.main_iteration(block=False) self.failUnless(self.buffer) copool.pause("test") self.buffer = None gtk.main_iteration(block=False) gtk.main_iteration(block=False) self.failIf(self.buffer) copool.add(self.__set_buffer, funcid="test") gtk.main_iteration(block=False) gtk.main_iteration(block=False) self.failUnless(self.buffer) copool.pause("test") self.buffer = None gtk.main_iteration(block=False) gtk.main_iteration(block=False) self.failIf(self.buffer)
def test_pause_restart_pause(self): copool.add(self.__set_buffer, funcid="test") Gtk.main_iteration_do(False) Gtk.main_iteration_do(False) self.failUnless(self.buffer) copool.pause("test") self.buffer = None Gtk.main_iteration_do(False) Gtk.main_iteration_do(False) self.failIf(self.buffer) copool.add(self.__set_buffer, funcid="test") Gtk.main_iteration_do(False) Gtk.main_iteration_do(False) self.failUnless(self.buffer) copool.pause("test") self.buffer = None Gtk.main_iteration_do(False) Gtk.main_iteration_do(False) self.failIf(self.buffer)
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")