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

Conversation

mrocklin
Copy link
Member

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

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
Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @mrocklin!

We also do something similar over in distributed/distributed/comm/tests/test_comms.py

EXTERNAL_IP4 = get_ip()
if has_ipv6():
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
EXTERNAL_IP6 = get_ipv6()

If you want to update there too, that'd be welcome. Though this PR is a definite improvement over our current behavior and can be merged as is too

@jrbourbeau jrbourbeau merged commit a7268f0 into dask:master Jan 18, 2021
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants