Check whether IPv6 is enabled on this host.
()
| 127 | raise unittest.SkipTest('cannot bind AF_UNIX sockets') |
| 128 | |
| 129 | def _is_ipv6_enabled(): |
| 130 | """Check whether IPv6 is enabled on this host.""" |
| 131 | if socket.has_ipv6: |
| 132 | sock = None |
| 133 | try: |
| 134 | sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) |
| 135 | sock.bind((HOSTv6, 0)) |
| 136 | return True |
| 137 | except OSError: |
| 138 | pass |
| 139 | finally: |
| 140 | if sock: |
| 141 | sock.close() |
| 142 | return False |
| 143 | |
| 144 | IPV6_ENABLED = _is_ipv6_enabled() |
| 145 |
no test coverage detected
searching dependent graphs…