commit: 36d91d94d52cc14b62201c8b3319b308f41f6321
Author: Michał Górny gentoo org>
AuthorDate: Wed Nov 15 08:07:43 2023 +
Commit: Michał Górny gentoo org>
CommitDate: Wed Nov 15 08:07:43 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36d91d94
dev-python/contourpy: Grab a fix for running tests on unicore system
Signed-off-by: Michał Górny gentoo.org>
dev-python/contourpy/contourpy-1.2.0.ebuild| 5 ++
.../contourpy/files/contourpy-1.2.0-unicore.patch | 83 ++
2 files changed, 88 insertions(+)
diff --git a/dev-python/contourpy/contourpy-1.2.0.ebuild
b/dev-python/contourpy/contourpy-1.2.0.ebuild
index dd6add3e91a1..22e5a6586da3 100644
--- a/dev-python/contourpy/contourpy-1.2.0.ebuild
+++ b/dev-python/contourpy/contourpy-1.2.0.ebuild
@@ -42,6 +42,11 @@ DISTUTILS_ARGS=(
distutils_enable_tests pytest
+PATCHES=(
+ # https://github.com/contourpy/contourpy/pull/327
+ "${FILESDIR}/${P}-unicore.patch"
+)
+
python_test() {
local EPYTEST_IGNORE=(
# linters
diff --git a/dev-python/contourpy/files/contourpy-1.2.0-unicore.patch
b/dev-python/contourpy/files/contourpy-1.2.0-unicore.patch
new file mode 100644
index ..c25a1807dcd4
--- /dev/null
+++ b/dev-python/contourpy/files/contourpy-1.2.0-unicore.patch
@@ -0,0 +1,83 @@
+From f948f821c705329a98bbcdcba5b642fe6c6f0b74 Mon Sep 17 00:00:00 2001
+From: matoro
+Date: Wed, 15 Nov 2023 02:18:49 -0500
+Subject: [PATCH] Support running tests on unicore hosts
+
+All tests pass except those explicitly asserting that they are on a
+multicore system. Adds a conditional skip to those which are only
+useful on multicore hosts.
+---
+ tests/test_filled.py | 7 +--
+ tests/test_lines.py | 7 +--
+ tests/test_misc.py | 8 +---
+ 3 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/tests/test_filled.py b/tests/test_filled.py
+index b239f3b..c41e0d1 100644
+--- a/tests/test_filled.py
b/tests/test_filled.py
+@@ -8,7 +8,7 @@
+ from numpy.testing import assert_allclose, assert_array_equal
+ import pytest
+
+-from contourpy import FillType, contour_generator
++from contourpy import FillType, contour_generator, max_threads
+ from contourpy.util.data import random, simple
+
+ from . import util_test
+@@ -734,7 +734,10 @@ def assert_chunk_offsets(offsets_or_none:
list[cpy.OffsetArray | None]) -> None:
+ @pytest.mark.threads
+ @pytest.mark.parametrize("fill_type", FillType.__members__.values())
+ @pytest.mark.parametrize("name, thread_count",
+- [("serial", 1), ("threaded", 1), ("threaded", 2)])
++ [("serial", 1), ("threaded", 1),
++ pytest.param("threaded", 2,
++marks = pytest.mark.skipif(
++max_threads() <= 1, reason = "executing on
unicore host"))])
+ def test_return_by_fill_type_chunk(
+ xyz_chunk_test: tuple[cpy.CoordinateArray, ...],
+ name: str,
+diff --git a/tests/test_lines.py b/tests/test_lines.py
+index 9608591..0b0833b 100644
+--- a/tests/test_lines.py
b/tests/test_lines.py
+@@ -6,7 +6,7 @@
+ from numpy.testing import assert_allclose, assert_array_equal
+ import pytest
+
+-from contourpy import LineType, contour_generator
++from contourpy import LineType, contour_generator, max_threads
+ from contourpy.util.data import random, simple
+
+ from . import util_test
+@@ -707,7 +707,10 @@ def test_return_by_line_type(
+ @pytest.mark.threads
+ @pytest.mark.parametrize("line_type", LineType.__members__.values())
+ @pytest.mark.parametrize("name, thread_count",
+- [("serial", 1), ("threaded", 1), ("threaded", 2)])
++ [("serial", 1), ("threaded", 1),
++ pytest.param("threaded", 2,
++marks = pytest.mark.skipif(
++max_threads() <= 1, reason = "executing on
unicore host"))])
+ def test_return_by_line_type_chunk(
+ xyz_chunk_test: tuple[cpy.CoordinateArray, ...],
+ name: str,
+diff --git a/tests/test_misc.py b/tests/test_misc.py
+index 5e46e3f..acd558a 100644
+--- a/tests/test_misc.py
b/tests/test_misc.py
+@@ -2,13 +2,7 @@
+
+ import numpy as np
+
+-from contourpy import _remove_z_mask, contour_generator, max_threads
+-
+-
+-def test_max_threads() -> None:
+-n = max_threads()
+-# Assume testing on machine with 2 or more cores.
+-assert n > 1
++from contourpy import _remove_z_mask, contour_generator
+
+
+ def test_nan() -> None: