commit:     21544ce0cfce90ce900da3226926d14f346544f3
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 15 15:27:37 2021 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Mon Mar 15 15:37:06 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21544ce0

www-servers/gunicorn: make worker tests optional rather than skip them 
altogether

Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 .../gunicorn-20.1.0-tests_optional_modules.patch   | 22 ++++++++++++++++++++++
 www-servers/gunicorn/gunicorn-20.1.0.ebuild        |  8 ++++----
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git 
a/www-servers/gunicorn/files/gunicorn-20.1.0-tests_optional_modules.patch 
b/www-servers/gunicorn/files/gunicorn-20.1.0-tests_optional_modules.patch
new file mode 100644
index 00000000000..d04c300c207
--- /dev/null
+++ b/www-servers/gunicorn/files/gunicorn-20.1.0-tests_optional_modules.patch
@@ -0,0 +1,22 @@
+--- a/tests/workers/test_geventlet.py
++++ b/tests/workers/test_geventlet.py
+@@ -3,5 +3,8 @@
+ # This file is part of gunicorn released under the MIT license.
+ # See the NOTICE for more information.
+ 
++import pytest
++pytest.importorskip('eventlet')
++
+ def test_import():
+     __import__('gunicorn.workers.geventlet')
+--- a/tests/workers/test_ggevent.py
++++ b/tests/workers/test_ggevent.py
+@@ -3,5 +3,8 @@
+ # This file is part of gunicorn released under the MIT license.
+ # See the NOTICE for more information.
+ 
++import pytest
++pytest.importorskip('gevent')
++
+ def test_import():
+     __import__('gunicorn.workers.ggevent')

diff --git a/www-servers/gunicorn/gunicorn-20.1.0.ebuild 
b/www-servers/gunicorn/gunicorn-20.1.0.ebuild
index 7905e095b6e..cb38379151a 100644
--- a/www-servers/gunicorn/gunicorn-20.1.0.ebuild
+++ b/www-servers/gunicorn/gunicorn-20.1.0.ebuild
@@ -19,17 +19,17 @@ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 
~sparc ~x86 ~x64-mac
 
 RDEPEND="dev-python/setproctitle[${PYTHON_USEDEP}]"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-20.1.0-tests_optional_modules.patch
+)
+
 DOCS=( README.rst )
 
 distutils_enable_sphinx 'docs/source' --no-autodoc
 distutils_enable_tests pytest
 
 src_prepare() {
-       # These fail if respective optional packages have not been installed
-       rm -f tests/workers/test_g{eventlet,gevent}.py
-
        sed -e 's:--cov=gunicorn --cov-report=xml::' -i setup.cfg || die
-
        distutils-r1_src_prepare
 }
 

Reply via email to