Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't require network to inspect tests #4433

Merged
merged 1 commit into from Jan 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest.skip does not have a reason kwarg. Just use raise pytest.skip("no network access")

[  346s]     @pytest.mark.asyncio
[  346s]     async def test_server_listen():
[  346s]         """
[  346s]         Test various Server.listen() arguments and their effect.
[  346s]         """
[  346s]         import socket
[  346s]     
[  346s]         try:
[  346s]             EXTERNAL_IP4 = get_ip()
[  346s]             if has_ipv6():
[  346s]                 EXTERNAL_IP6 = get_ipv6()
[  346s]         except socket.gaierror:
[  346s] >           raise pytest.skip(reason="no network access")
[  346s] E           TypeError: skip() got an unexpected keyword argument 'reason'
[  346s] 
[  346s] distributed/tests/test_core.py:199: TypeError

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bnavigator! See #4467


from contextlib import asynccontextmanager

@asynccontextmanager
Expand Down