MCPcopy
hub / github.com/urllib3/urllib3 / _has_route

Function _has_route

test/__init__.py:157–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155 )
156
157 def _has_route() -> bool:
158 try:
159 sock = socket.create_connection((TARPIT_HOST, 80), 0.0001)
160 sock.close()
161 return True
162 except TimeoutError:
163 return True
164 except OSError as e:
165 if _is_unreachable_err(e):
166 return False
167 else:
168 raise
169
170 def _skip_if_no_route(f: _TestFuncT) -> _TestFuncT:
171 """Skip test exuction if network is unreachable"""

Callers 1

wrapperFunction · 0.85

Calls 2

_is_unreachable_errFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected