public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pydantic-extra-types] f43: Patch out tests that would require pytz
@ 2026-08-17 15:43 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-08-17 15:43 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-pydantic-extra-types
            Branch : f43
            Commit : 3eb686191b1c625dcc6538f611091ba8e6f6d0fd
            Author : Benjamin A. Beasley <code@musicinmybrain.net>
            Date   : 2026-08-17T12:12:35+01:00
            Stats  : +63/-2 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-pydantic-extra-types/c/3eb686191b1c625dcc6538f611091ba8e6f6d0fd?branch=f43

            Log:
            Patch out tests that would require pytz

- Fixes FTBFS due to a discrepancy in pytz vs. zoneinfo zone names

---
diff --git a/0001-Downstream-only-patch-out-tests-that-would-require-p.patch b/0001-Downstream-only-patch-out-tests-that-would-require-p.patch
new file mode 100644
index 0000000..ba8b7b2
--- /dev/null
+++ b/0001-Downstream-only-patch-out-tests-that-would-require-p.patch
@@ -0,0 +1,52 @@
+From b6e72a8dc08497b9331183c122cce9d547e8d61a Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Mon, 17 Aug 2026 12:02:49 +0100
+Subject: [PATCH] Downstream-only: patch out tests that would require pytz
+
+---
+ tests/test_timezone_names.py | 15 ---------------
+ 1 file changed, 15 deletions(-)
+
+diff --git a/tests/test_timezone_names.py b/tests/test_timezone_names.py
+index 7c5cb6f..107c75e 100644
+--- a/tests/test_timezone_names.py
++++ b/tests/test_timezone_names.py
+@@ -1,7 +1,6 @@
+ import re
+ 
+ import pytest
+-import pytz
+ from pydantic import BaseModel, ValidationError
+ from pydantic_core import PydanticCustomError
+ 
+@@ -13,9 +12,6 @@ try:
+ except ImportError:
+     has_zone_info = False
+ 
+-pytz_zones_bad = [(zone.lower(), zone) for zone in pytz.all_timezones]
+-pytz_zones_bad.extend([(f' {zone}', zone) for zone in pytz.all_timezones_set])
+-
+ 
+ class TZNameCheck(BaseModel):
+     timezone_name: TimeZoneName
+@@ -30,17 +26,6 @@ class NonStrictTzName(BaseModel):
+     timezone_name: TZNonStrict
+ 
+ 
+-@pytest.mark.parametrize('zone', pytz.all_timezones)
+-def test_all_timezones_non_strict_pytz(zone):
+-    assert TZNameCheck(timezone_name=zone).timezone_name == zone
+-    assert NonStrictTzName(timezone_name=zone).timezone_name == zone
+-
+-
+-@pytest.mark.parametrize('zone', pytz_zones_bad)
+-def test_all_timezones_pytz_lower(zone):
+-    assert NonStrictTzName(timezone_name=zone[0]).timezone_name == zone[1]
+-
+-
+ def test_fail_non_existing_timezone():
+     with pytest.raises(
+         ValidationError,
+-- 
+2.55.0
+

diff --git a/python-pydantic-extra-types.spec b/python-pydantic-extra-types.spec
index 79e7470..3b34da1 100644
--- a/python-pydantic-extra-types.spec
+++ b/python-pydantic-extra-types.spec
@@ -27,6 +27,15 @@ Patch:          %{forgeurl}/commit/6f0217de5e26b99d09ffd9bb95da415779e6bef6.patc
 # (without changes to uv.lock, which we don’t use)
 Patch:          pydantic-extra-types-2.11.2-python-ulid-v4.patch
 
+# Downstream-only: patch out tests that would require pytz
+#
+# We *could* BuildRequire pytz, but it’s nice to reduce dependencies on it in
+# general since it can be replaced by the standard library’s zoneinfo module,
+# and futhermore these tests can have spurious failures when pytz and zoneinfo
+# are using different versions of the timezone database and there’s a
+# discrepancy in their respective lists of all timezone names.
+Patch:          0001-Downstream-only-patch-out-tests-that-would-require-p.patch
+
 BuildArch:      noarch
 
 BuildRequires:  python3-devel
@@ -34,8 +43,8 @@ BuildRequires:  tomcli
 %if %{with tests}
 BuildRequires:  %{py3_dist dirty-equals}
 BuildRequires:  %{py3_dist pytest}
-# We patched this out of the “all” extra, but it is still a test dependency.
-BuildRequires:  %{py3_dist pytz}
+# We patched pytz out of the “all” extra, and we don’t want to test with it,
+# either. See 0001-Downstream-only-patch-out-tests-that-would-require-p.patch.
 %endif
 
 %if %{with cron} && %{with pendulum} && %{with phonenumbers} && %{with pycountry} && %{with pymongo}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-17 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-17 15:43 [rpms/python-pydantic-extra-types] f43: Patch out tests that would require pytz Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox