summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-08-12 18:08:59 +0200
committerMichał Górny <mgorny@gentoo.org>2023-08-12 18:12:32 +0200
commit092d354cb65458249ee780530456cd0263b28bc7 (patch)
treeaee7c140044746047f479f79e5dd69861d540c45
parentdev-python/psutil: Remove old (diff)
downloadgentoo-092d354cb65458249ee780530456cd0263b28bc7.tar.gz
gentoo-092d354cb65458249ee780530456cd0263b28bc7.tar.bz2
gentoo-092d354cb65458249ee780530456cd0263b28bc7.zip
dev-python/cattrs: Add a patch to fix tests on 32-bit systems
Closes: https://bugs.gentoo.org/912187 Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--dev-python/cattrs/cattrs-23.1.2.ebuild5
-rw-r--r--dev-python/cattrs/files/cattrs-23.1.2-32bit-time_t.patch38
2 files changed, 43 insertions, 0 deletions
diff --git a/dev-python/cattrs/cattrs-23.1.2.ebuild b/dev-python/cattrs/cattrs-23.1.2.ebuild
index e7a53a8e43d0..1d859d02cd96 100644
--- a/dev-python/cattrs/cattrs-23.1.2.ebuild
+++ b/dev-python/cattrs/cattrs-23.1.2.ebuild
@@ -50,6 +50,11 @@ BDEPEND="
distutils_enable_tests pytest
src_prepare() {
+ local PATCHES=(
+ # https://github.com/python-attrs/cattrs/pull/415
+ "${FILESDIR}/${P}-32bit-time_t.patch"
+ )
+
sed -e 's:--benchmark.*::' \
-e '/addopts/d' \
-i pyproject.toml || die
diff --git a/dev-python/cattrs/files/cattrs-23.1.2-32bit-time_t.patch b/dev-python/cattrs/files/cattrs-23.1.2-32bit-time_t.patch
new file mode 100644
index 000000000000..68d1606c7b31
--- /dev/null
+++ b/dev-python/cattrs/files/cattrs-23.1.2-32bit-time_t.patch
@@ -0,0 +1,38 @@
+From 1b001c30090876dd9cefa3aefac8218ad78222c0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 12 Aug 2023 18:04:07 +0200
+Subject: [PATCH] Fix typeddict tests on systems with 32-bit time_t
+
+Reduce the range of generated `datetime` instances to values valid
+for 32-bit `time_t` range, as otherwise multiple tests fail with errors
+such as:
+
+ FAILED tests/test_typeddicts.py::test_simple_roundtrip - OverflowError: timestamp out of range for platform time_t
+
+This is based on an earlier fix for `test_preconf.py`,
+see a0e56f43f061c43814d6f938833d1c325ed61525
+and c58028789454fc7a9b459b94c214cab2ab1acb81.
+
+Originally reported as https://bugs.gentoo.org/912187.
+---
+ tests/typeddicts.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/typeddicts.py b/tests/typeddicts.py
+index d7f8141..4f7804d 100644
+--- a/tests/typeddicts.py
++++ b/tests/typeddicts.py
+@@ -59,7 +59,9 @@ def int_attributes(
+ def datetime_attributes(
+ draw: DrawFn, total: bool = True, not_required: bool = False
+ ) -> Tuple[datetime, SearchStrategy, SearchStrategy]:
+- success_strat = datetimes().map(lambda dt: dt.replace(microsecond=0))
++ success_strat = datetimes(
++ min_value=datetime(1970, 1, 1), max_value=datetime(2038, 1, 1)
++ ).map(lambda dt: dt.replace(microsecond=0))
+ type = datetime
+ strat = success_strat if total else success_strat | just(NOTHING)
+ if not_required and draw(booleans()):
+--
+2.41.0
+