commit:     abe7707846fb7ccd4926444c8f26860787f51f44
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon May 25 14:43:37 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon May 25 16:16:26 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abe77078

dev-python/toml: Handle missing numpy gracefully

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/toml/files/toml-0.10.1-skip-numpy.patch | 37 ++++++++++++++++++++++
 dev-python/toml/toml-0.10.1.ebuild                 |  3 ++
 2 files changed, 40 insertions(+)

diff --git a/dev-python/toml/files/toml-0.10.1-skip-numpy.patch 
b/dev-python/toml/files/toml-0.10.1-skip-numpy.patch
new file mode 100644
index 00000000000..5c6808d2daf
--- /dev/null
+++ b/dev-python/toml/files/toml-0.10.1-skip-numpy.patch
@@ -0,0 +1,37 @@
+From 93901215b45db2ab9d50987ac109c29acbe34600 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
+Date: Mon, 25 May 2020 16:38:17 +0200
+Subject: [PATCH] Skip numpy tests when numpy is not available
+
+Make it possible to successfully run tests without numpy installed.
+This package is becoming quite hard profile, and being able to test it
+without building numpy first would be a nice feature.
+---
+ tests/test_api.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/test_api.py b/tests/test_api.py
+index dd12eb3..67bcd88 100644
+--- a/tests/test_api.py
++++ b/tests/test_api.py
+@@ -103,7 +103,7 @@ def test_array_sep():
+ 
+ 
+ def test_numpy_floats():
+-    import numpy as np
++    np = pytest.importorskip('numpy')
+ 
+     encoder = toml.TomlNumpyEncoder()
+     d = {'a': np.array([1, .3], dtype=np.float64)}
+@@ -120,7 +120,7 @@ def test_numpy_floats():
+ 
+ 
+ def test_numpy_ints():
+-    import numpy as np
++    np = pytest.importorskip('numpy')
+ 
+     encoder = toml.TomlNumpyEncoder()
+     d = {'a': np.array([1, 3], dtype=np.int64)}
+-- 
+2.26.2
+

diff --git a/dev-python/toml/toml-0.10.1.ebuild 
b/dev-python/toml/toml-0.10.1.ebuild
index 2dc1660a0ca..e0c1f393ad3 100644
--- a/dev-python/toml/toml-0.10.1.ebuild
+++ b/dev-python/toml/toml-0.10.1.ebuild
@@ -23,6 +23,9 @@ BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
        test? ( $(python_gen_cond_dep 'dev-python/numpy[${PYTHON_USEDEP}]' 
'python3*') )"
 
 DOCS=( README.rst )
+PATCHES=(
+       "${FILESDIR}"/toml-0.10.1-skip-numpy.patch
+)
 
 distutils_enable_tests pytest
 

Reply via email to