def test_connect_with_default_timeout_fail(): rsocket.setdefaulttimeout(0.1) s = RSocket() rsocket.setdefaulttimeout(None) assert s.gettimeout() == 0.1 with pytest.raises(SocketTimeout): s.connect(INETAddress('172.30.172.30', 12345)) s.close()
def setdefaulttimeout(space, w_timeout): if space.is_w(w_timeout, space.w_None): timeout = -1.0 else: timeout = space.float_w(w_timeout) if timeout < 0.0: raise oefmt(space.w_ValueError, "Timeout value out of range") rsocket.setdefaulttimeout(timeout)
def setdefaulttimeout(space, w_timeout): if space.is_w(w_timeout, space.w_None): timeout = -1.0 else: timeout = space.float_w(w_timeout) if timeout < 0.0: raise OperationError(space.w_ValueError, space.wrap("Timeout value out of range")) rsocket.setdefaulttimeout(timeout)
def setdefaulttimeout(space, w_timeout): if space.is_w(w_timeout, space.w_None): timeout = -1.0 else: timeout = space.float_w(w_timeout) if timeout < 0.0: raise OperationError(space.w_ValueError, space.wrap('Timeout value out of range')) rsocket.setdefaulttimeout(timeout)