Check for (local) IPv6 support.
()
| 141 | return bytearray(addr).hex() |
| 142 | |
| 143 | def test_ipv6_local(): |
| 144 | ''' |
| 145 | Check for (local) IPv6 support. |
| 146 | ''' |
| 147 | # By using SOCK_DGRAM this will not actually make a connection, but it will |
| 148 | # fail if there is no route to IPv6 localhost. |
| 149 | have_ipv6 = True |
| 150 | try: |
| 151 | s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) |
| 152 | s.connect(('::1', 1)) |
| 153 | except socket.error: |
| 154 | have_ipv6 = False |
| 155 | return have_ipv6 |
no test coverage detected