diff options
author | Jakub Stasiak <jakub@stasiak.at> | 2020-06-14 23:47:19 +0200 |
---|---|---|
committer | Jakub Stasiak <jakub@stasiak.at> | 2020-06-15 01:17:54 +0200 |
commit | 5c3a4eda0d38672b230c7e8341d08457a48f5c5c (patch) | |
tree | 4e54be90eefff8d1b03cf70fcea08970aac6e17e | |
parent | 52749f592c614a548b7223a8987ce0307e99e939 (diff) | |
download | netaddr-5c3a4eda0d38672b230c7e8341d08457a48f5c5c.tar.gz |
Fix test expectations regarding inet_ntop behaviour on Mac
-rw-r--r-- | netaddr/tests/ip/test_platform_osx.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/netaddr/tests/ip/test_platform_osx.py b/netaddr/tests/ip/test_platform_osx.py index 264005d..c28bceb 100644 --- a/netaddr/tests/ip/test_platform_osx.py +++ b/netaddr/tests/ip/test_platform_osx.py @@ -1,3 +1,5 @@ +import platform + import pytest from netaddr import iprange_to_cidrs, IPNetwork, IPAddress, INET_PTON, AddrFormatError @@ -71,9 +73,13 @@ def test_ip_behaviour_osx(): IPNetwork('::255.255.255.254/128'), ] - # inet_pton has to be different on Mac OSX *sigh* + # inet_pton has to be different on Mac OSX *sigh*... assert IPAddress('010.000.000.001', flags=INET_PTON) == IPAddress('10.0.0.1') - assert int_to_str(0xffff) == '::0.0.255.255' + # ...but at least Apple changed inet_ntop in Mac OS 10.15 (Catalina) so it's compatible with Linux + if platform.mac_ver()[0] >= '10.15': + assert int_to_str(0xffff) == '::ffff' + else: + assert int_to_str(0xffff) == '::0.0.255.255' @pytest.mark.skipif('sys.platform == "darwin"') |