dev-python/docker-py: Use localhost instead of hostname in tests
authorMichał Górny <mgorny@gentoo.org>
Fri, 27 Mar 2020 15:23:07 +0000 (16:23 +0100)
committerMichał Górny <mgorny@gentoo.org>
Fri, 27 Mar 2020 15:24:30 +0000 (16:24 +0100)
Use 'localhost' in tests since it has a better chance of being
resolvable (via /etc/hosts) inside network-sandbox than the system
hostname.

Closes: https://bugs.gentoo.org/715052
Signed-off-by: Michał Górny <mgorny@gentoo.org>
dev-python/docker-py/docker-py-4.2.0-r1.ebuild

index 3464896ea91ad1e5b329d3c86cb6b9b655f9f6f0..33f23b60489212f88f90fec90bafe8189f98bad8 100644 (file)
@@ -39,6 +39,14 @@ distutils_enable_sphinx docs \
        'dev-python/recommonmark' \
        '>=dev-python/sphinx-1.4.6'
 
+src_prepare() {
+       # localhost has a better chance of being in /etc/hosts
+       sed -e 's:socket[.]gethostname():"localhost":' \
+               -i tests/unit/api_test.py || die
+
+       distutils-r1_src_prepare
+}
+
 python_test() {
        pytest -vv tests/unit/ || die "tests failed under ${EPYTHON}"
 }