def test_wait_sentinel(self): p = self.Process(target=self._test_wait_sentinel) with pytest.raises(ValueError): p.sentinel p.start() sentinel = p.sentinel assert isinstance(sentinel, int) assert not wait([sentinel], timeout=0.0) assert wait([sentinel], timeout=5), (p.exitcode) expected_code = 15 if sys.platform == 'win32' else -15 p.join() # force refresh of p.exitcode assert p.exitcode == expected_code
def wait_for_handle(handle, timeout): from loky.backend.compat import wait if timeout is not None and timeout < 0.0: timeout = None return wait([handle], timeout)