()
| 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""" |
no test coverage detected