Skip to content

Commit 7562cb0

Browse files
committed
Travis download GeoIP DBs + skip v4_convert True tests if not supported
1 parent 3ddfd45 commit 7562cb0

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ python:
1212
before_install:
1313
- sudo apt-get update -qy
1414
- sudo apt-get install -qy iputils-ping
15+
- "sudo rsync -avh 'rsync://files.privex.io/cdn/extras/GeoIP/*.mmdb' /usr/share/GeoIP/"
1516
install:
1617
- pip install -U '.[dev]'
1718
script: pytest --cov=./privex -rxXs -v

tests/test_net.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,23 @@ def test_resolve_ips_v4_convert_false(self):
180180
def test_resolve_ips_v4_convert(self):
181181
"""Test :func:`.resolve_ips` returns IPv6-wrapped IPv4 addresses for ``microsoft.com`` when v4_convert is enabled + v6 version"""
182182
ips = helpers.resolve_ips('microsoft.com', 'v6', v4_convert=True)
183+
if ips is None or len(ips) == 0:
184+
return pytest.skip(
185+
f"Skipping test TestNetResolveIP.test_resolve_ips_v4_convert as v6-wrapped IPv4 addresses "
186+
f"aren't supported on this platform."
187+
)
183188
self.assertTrue(ips[0].startswith('::ffff:'))
184189

185190
# --- privex.helpers.net.resolve_ip ---
186191

187192
def test_resolve_ip_v4_convert(self):
188193
"""Test :func:`.resolve_ip` returns an IPv6-wrapped IPv4 address for ``microsoft.com`` when v4_convert is enabled + v6 version"""
189194
ip = helpers.resolve_ip('microsoft.com', 'v6', v4_convert=True)
195+
if ip is None:
196+
return pytest.skip(
197+
f"Skipping test TestNetResolveIP.test_resolve_ip_v4_convert as v6-wrapped IPv4 addresses "
198+
f"aren't supported on this platform."
199+
)
190200
self.assertTrue(ip.startswith('::ffff:'))
191201

192202
def test_resolve_ip_hiveseed(self):

0 commit comments

Comments
 (0)