Skip to content

Commit

Permalink
Don't require network to inspect tests (#4433)
Browse files Browse the repository at this point in the history
Previously the get_ipv6 function was called at import time in test_core.py
This stopped any tests from running if a network adapter was not
attached

The results of this function were used only in one test,
so we move this call within that test and skip if it fails
  • Loading branch information
mrocklin committed Jan 18, 2021
1 parent 467bbc2 commit a7268f0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions distributed/tests/test_core.py
Expand Up @@ -42,11 +42,6 @@
from distributed.utils_test import loop # noqa F401


EXTERNAL_IP4 = get_ip()
if has_ipv6():
EXTERNAL_IP6 = get_ipv6()


def echo(comm, x):
return x

Expand Down Expand Up @@ -194,6 +189,15 @@ async def test_server_listen():
"""
Test various Server.listen() arguments and their effect.
"""
import socket

try:
EXTERNAL_IP4 = get_ip()
if has_ipv6():
EXTERNAL_IP6 = get_ipv6()
except socket.gaierror:
raise pytest.skip(reason="no network access")

from contextlib import asynccontextmanager

@asynccontextmanager
Expand Down

0 comments on commit a7268f0

Please sign in to comment.