From 6b854d783748aa5e48339bf9566ef366c1e21207 Mon Sep 17 00:00:00 2001 From: Tomas Orsava Date: Tue, 7 Mar 2023 14:38:48 +0100 Subject: [PATCH] Disable tests for the AMT timezone from the first half of the 20th century Resolves: rhbz#2176127 --- pytz.spec | 11 +++- remove_amsterdam_pre_1937_tests.patch | 82 +++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 remove_amsterdam_pre_1937_tests.patch diff --git a/pytz.spec b/pytz.spec index 4a6b44c..16e6071 100644 --- a/pytz.spec +++ b/pytz.spec @@ -7,7 +7,7 @@ Name: pytz Version: 2017.2 -Release: 12%{?dist} +Release: 13%{?dist} Summary: World Timezone Definitions for Python Group: Development/Languages @@ -18,6 +18,10 @@ Source0: https://pypi.io/packages/source/p/%{name}/%{name}-%{version}.zip Patch0: pytz-zoneinfo.patch # https://bugzilla.redhat.com/1497572 Patch1: remove_tzinfo_test.patch +# Remove tests failing due to changes in the handling of an ancient timezone +# See: https://bugzilla.redhat.com/show_bug.cgi?id=2176127 +# Upstream commit: https://github.com/stub42/pytz/commit/07aa4d962dae5cb7ced4f61fe85a9001a01676df +Patch2: remove_amsterdam_pre_1937_tests.patch BuildArch: noarch BuildRequires: python2-devel @@ -65,6 +69,7 @@ Almost all (over 540) of the Olson timezones are supported. %setup -q %patch0 -p1 -b .zoneinfo %patch1 -p1 -b .removeTest +%patch2 -p1 -b .disableTests %build @@ -116,6 +121,10 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v %changelog +* Tue Mar 07 2023 Tomas Orsava - 2017.2-13 +- Remove tests for the AMT timezone from the first half of the 20th century +- Resolves: rhbz#2176127 + * Thu Apr 25 2019 Tomas Orsava - 2017.2-12 - Bumping due to problems with modular RPM upgrade path - Resolves: rhbz#1695587 diff --git a/remove_amsterdam_pre_1937_tests.patch b/remove_amsterdam_pre_1937_tests.patch new file mode 100644 index 0000000..b6825d1 --- /dev/null +++ b/remove_amsterdam_pre_1937_tests.patch @@ -0,0 +1,82 @@ +From cf731c62ff7580ee96b6967671a4f2ada3a71b21 Mon Sep 17 00:00:00 2001 +From: Tomas Orsava +Date: Tue, 7 Mar 2023 14:22:18 +0100 +Subject: [PATCH] Remove tests failing due to changes in the handling of an + ancient timezone + +See: https://bugzilla.redhat.com/show_bug.cgi?id=2176127 +See also: https://github.com/stub42/pytz/commit/07aa4d962dae5cb7ced4f61fe85a9001a01676df +--- + pytz/tests/test_tzinfo.py | 49 --------------------------------------- + 1 file changed, 49 deletions(-) + +diff --git a/pytz/tests/test_tzinfo.py b/pytz/tests/test_tzinfo.py +index beb0490..9472dce 100644 +--- a/pytz/tests/test_tzinfo.py ++++ b/pytz/tests/test_tzinfo.py +@@ -601,35 +601,6 @@ class ReferenceUSEasternDSTEndTestCase(USEasternDSTEndTestCase): + + class LocalTestCase(unittest.TestCase): + def testLocalize(self): +- loc_tz = pytz.timezone('Europe/Amsterdam') +- +- loc_time = loc_tz.localize(datetime(1930, 5, 10, 0, 0, 0)) +- # Actually +00:19:32, but Python datetime rounds this +- self.assertEqual(loc_time.strftime('%Z%z'), 'AMT+0020') +- +- loc_time = loc_tz.localize(datetime(1930, 5, 20, 0, 0, 0)) +- # Actually +00:19:32, but Python datetime rounds this +- self.assertEqual(loc_time.strftime('%Z%z'), 'NST+0120') +- +- loc_time = loc_tz.localize(datetime(1940, 5, 10, 0, 0, 0)) +- # pre-2017a, abbreviation was NCT +- self.assertEqual(loc_time.strftime('%Z%z'), '+0020+0020') +- +- loc_time = loc_tz.localize(datetime(1940, 5, 20, 0, 0, 0)) +- self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200') +- +- loc_time = loc_tz.localize(datetime(2004, 2, 1, 0, 0, 0)) +- self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100') +- +- loc_time = loc_tz.localize(datetime(2004, 4, 1, 0, 0, 0)) +- self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200') +- +- tz = pytz.timezone('Europe/Amsterdam') +- loc_time = loc_tz.localize(datetime(1943, 3, 29, 1, 59, 59)) +- self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100') +- +- +- # Switch to US + loc_tz = pytz.timezone('US/Eastern') + + # End of DST ambiguity check +@@ -700,26 +671,6 @@ class LocalTestCase(unittest.TestCase): + '2004-04-04 01:50:00 EST-0500' + ) + +- def testPartialMinuteOffsets(self): +- # utcoffset in Amsterdam was not a whole minute until 1937 +- # However, we fudge this by rounding them, as the Python +- # datetime library +- tz = pytz.timezone('Europe/Amsterdam') +- utc_dt = datetime(1914, 1, 1, 13, 40, 28, tzinfo=UTC) # correct +- utc_dt = utc_dt.replace(second=0) # But we need to fudge it +- loc_dt = utc_dt.astimezone(tz) +- self.assertEqual( +- loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'), +- '1914-01-01 14:00:00 AMT+0020' +- ) +- +- # And get back... +- utc_dt = loc_dt.astimezone(UTC) +- self.assertEqual( +- utc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'), +- '1914-01-01 13:40:00 UTC+0000' +- ) +- + def no_testCreateLocaltime(self): + # It would be nice if this worked, but it doesn't. + tz = pytz.timezone('Europe/Amsterdam') +-- +2.38.1 +