Skip to content

Commit

Permalink
Fix tests broken by new netaddr version
Browse files Browse the repository at this point in the history
netaddr 1.0.0 disabled its INET_ATON flag by default, breaking some of
our tests. Re-enable the flag so the tests pass again.
  • Loading branch information
seanh committed Jun 11, 2024
1 parent 13f0eb6 commit 0f57fb3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .cookiecutter/includes/setuptools/install_requires
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requests
jsonschema
importlib_resources
netaddr
netaddr>1.0.0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ install_requires =
requests
jsonschema
importlib_resources
netaddr
netaddr>1.0.0

[options.packages.find]
where = src
Expand Down
4 changes: 2 additions & 2 deletions src/checkmatelib/url/canonicalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
from urllib.parse import ParseResult, unquote, urlparse

from netaddr import AddrFormatError, IPAddress
from netaddr import INET_ATON, AddrFormatError, IPAddress

from checkmatelib.exceptions import BadURL

Expand Down Expand Up @@ -180,7 +180,7 @@ def _canonicalize_path(cls, path):
def _decode_ip(cls, hostname):
"""Try and spot hostnames that are really encoded IP addresses."""
try:
return str(IPAddress(hostname))
return str(IPAddress(hostname, flags=INET_ATON))
except (AddrFormatError, ValueError):
return None

Expand Down

0 comments on commit 0f57fb3

Please sign in to comment.