dev-python/test_server: Enable py2.7, fix tests
authorMichał Górny <mgorny@gentoo.org>
Mon, 18 Nov 2019 21:21:59 +0000 (22:21 +0100)
committerMichał Górny <mgorny@gentoo.org>
Mon, 18 Nov 2019 21:23:10 +0000 (22:23 +0100)
Signed-off-by: Michał Górny <mgorny@gentoo.org>
dev-python/test_server/test_server-0.0.31.ebuild

index 37e2a350c72d86fcef49336b5b2f5534010d952e..823107ea4a80a0d49acb2bdd0c5f6901fb1538e6 100644 (file)
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{5,6,7} )
+PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 inherit distutils-r1
 
 DESCRIPTION="Server to test HTTP clients"
@@ -22,3 +22,14 @@ RDEPEND="
 BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
 
 distutils_enable_tests pytest
+
+src_prepare() {
+       distutils-r1_src_prepare
+
+       # broken on py2.7, upstream knows
+       sed -i -e '5a\
+import sys' \
+               -e '/test_null_bytes/i\
+@pytest.mark.skipif(sys.hexversion < 0x03000000, reason="broken on py2")' \
+               test/server.py || die
+}