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

test: fix test on host with ipv6 disabled #6941

Closed
wants to merge 1 commit into from

Conversation

godsarmy
Copy link
Contributor

Description

Fix test failure on a host with ipv6 disabled

Checklist

  • I have updated tests where applicable.
  • I have added an entry to the CHANGELOG.

@@ -9,6 +10,7 @@ def test_get_local_ip():
local_ip.get_local_ip("invalid!")


@skip_no_ipv6
def test_get_local_ip6():
# should never error, but may return None depending on the host OS configuration.
Copy link
Member

Choose a reason for hiding this comment

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

The test is really here to ensure that we don't error, even in environments without IPv6. What error are you getting?

Copy link
Contributor Author

@godsarmy godsarmy Jun 21, 2024

Choose a reason for hiding this comment

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

On an ipv6 diabled host, the error message is as following:

"OSError: [Errno 97] Address family not supporterd by protocol"

I think skip_no_ipv6 is used to skip the test when detecting ipv6 is diabled on the host

Copy link
Member

@mhils mhils Jun 21, 2024

Choose a reason for hiding this comment

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

The test is correct, the underlying method needs to return None instead of raising. We don't want to skip the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so do you mean the code itself is wrong? If so, i can fix the code.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, correct. Thanks!

@godsarmy godsarmy closed this Jun 21, 2024
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

2 participants