summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-08-02 00:24:37 +0200
committerMichał Górny <mgorny@gentoo.org>2020-08-02 00:29:40 +0200
commit2b5ff91101ffed5aa0667b8f1cd0e288c894935f (patch)
treedafda9d91e72de3af8cd26a67bf4061450e77aa0 /dev-python
parentdev-python/sphinx-py3doc-enhanced-theme: Remove py2.7 (diff)
downloadgentoo-2b5ff91101ffed5aa0667b8f1cd0e288c894935f.tar.gz
gentoo-2b5ff91101ffed5aa0667b8f1cd0e288c894935f.tar.bz2
gentoo-2b5ff91101ffed5aa0667b8f1cd0e288c894935f.zip
dev-python/pytest-timeout: Fix testing without pytest-cov
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r--dev-python/pytest-timeout/files/pytest-timeout-1.4.2-optional-cov.patch27
-rw-r--r--dev-python/pytest-timeout/pytest-timeout-1.4.1-r1.ebuild4
-rw-r--r--dev-python/pytest-timeout/pytest-timeout-1.4.2.ebuild4
3 files changed, 35 insertions, 0 deletions
diff --git a/dev-python/pytest-timeout/files/pytest-timeout-1.4.2-optional-cov.patch b/dev-python/pytest-timeout/files/pytest-timeout-1.4.2-optional-cov.patch
new file mode 100644
index 000000000000..424cfa6c57d4
--- /dev/null
+++ b/dev-python/pytest-timeout/files/pytest-timeout-1.4.2-optional-cov.patch
@@ -0,0 +1,27 @@
+From 65a79fe8ceb52d7ae978f4a2ecc47a1fd34fda2b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 2 Aug 2020 00:11:53 +0200
+Subject: [PATCH] Skip test_cov if pytest-cov is not installed
+
+Skip test_cov gracefully if pytest_cov module can't be imported.
+This would help us since we're removing py2 support from pytest-cov
+but still need it for pytest-timeout.
+---
+ test_pytest_timeout.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/test_pytest_timeout.py b/test_pytest_timeout.py
+index 16302d7..69707b4 100644
+--- a/test_pytest_timeout.py
++++ b/test_pytest_timeout.py
+@@ -77,6 +77,7 @@ def test_thread(testdir):
+ )
+ def test_cov(testdir):
+ # This test requires pytest-cov
++ pytest.importorskip("pytest_cov")
+ testdir.makepyfile(
+ """
+ import time
+--
+2.28.0
+
diff --git a/dev-python/pytest-timeout/pytest-timeout-1.4.1-r1.ebuild b/dev-python/pytest-timeout/pytest-timeout-1.4.1-r1.ebuild
index 56fd0feec5d9..2821063d3083 100644
--- a/dev-python/pytest-timeout/pytest-timeout-1.4.1-r1.ebuild
+++ b/dev-python/pytest-timeout/pytest-timeout-1.4.1-r1.ebuild
@@ -28,6 +28,10 @@ BDEPEND="
distutils_enable_tests pytest
+PATCHES=(
+ "${FILESDIR}"/pytest-timeout-1.4.2-optional-cov.patch
+)
+
python_test() {
distutils_install_for_testing
diff --git a/dev-python/pytest-timeout/pytest-timeout-1.4.2.ebuild b/dev-python/pytest-timeout/pytest-timeout-1.4.2.ebuild
index 56fd0feec5d9..2821063d3083 100644
--- a/dev-python/pytest-timeout/pytest-timeout-1.4.2.ebuild
+++ b/dev-python/pytest-timeout/pytest-timeout-1.4.2.ebuild
@@ -28,6 +28,10 @@ BDEPEND="
distutils_enable_tests pytest
+PATCHES=(
+ "${FILESDIR}"/pytest-timeout-1.4.2-optional-cov.patch
+)
+
python_test() {
distutils_install_for_testing