From ba2a6845a2d78b645f16e12e78b5c85a11472282064cb164bd98e7918d315fe1 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 29 Jun 2017 07:02:05 +0000 Subject: [PATCH] Accepting request 506778 from home:tbechtold:branches:devel:languages:python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add 0001-Fix-tests-for-older-timezone-versions.patch . This fixes the tests on SLE12SP2 and SLE12SP3 OBS-URL: https://build.opensuse.org/request/show/506778 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pytz?expand=0&rev=63 --- ...ix-tests-for-older-timezone-versions.patch | 94 +++++++++++++++++++ python-pytz.changes | 6 ++ python-pytz.spec | 3 + 3 files changed, 103 insertions(+) create mode 100644 0001-Fix-tests-for-older-timezone-versions.patch diff --git a/0001-Fix-tests-for-older-timezone-versions.patch b/0001-Fix-tests-for-older-timezone-versions.patch new file mode 100644 index 0000000..0ce3cd1 --- /dev/null +++ b/0001-Fix-tests-for-older-timezone-versions.patch @@ -0,0 +1,94 @@ +From ba0f4aa2cb32d3e0338c389a0ee32ae8ceb1f367 Mon Sep 17 00:00:00 2001 +From: Thomas Bechtold +Date: Wed, 28 Jun 2017 12:28:31 +0200 +Subject: [PATCH] Fix tests for older timezone versions + +This improves the fix from commit c00dbe290b . +--- + src/pytz/tests/test_tzinfo.py | 26 ++++++++++++++------------ + 1 file changed, 14 insertions(+), 12 deletions(-) + +diff --git a/src/pytz/tests/test_tzinfo.py b/src/pytz/tests/test_tzinfo.py +index 3166322..0ecb8c0 100644 +--- a/src/pytz/tests/test_tzinfo.py ++++ b/src/pytz/tests/test_tzinfo.py +@@ -235,12 +235,14 @@ class USEasternDSTStartTestCase(unittest.TestCase): + + def _test_tzname(self, utc_dt, wanted): + tzname = wanted['tzname'] ++ if not isinstance(tzname, list): ++ tzname = [tzname] + dt = utc_dt.astimezone(self.tzinfo) +- self.assertEqual(dt.tzname(), tzname, +- 'Expected %s as tzname for %s. Got %s' % ( +- tzname, str(utc_dt), dt.tzname() +- ) +- ) ++ self.assertIn(dt.tzname(), tzname, ++ 'Expected %s as tzname for %s. Got %s' % ( ++ tzname, str(utc_dt), dt.tzname() ++ ) ++ ) + + def _test_utcoffset(self, utc_dt, wanted): + utcoffset = wanted['utcoffset'] +@@ -501,7 +503,7 @@ class NoumeaHistoryStartTestCase(USEasternDSTStartTestCase): + 'dst': timedelta(0), + } + after = { +- 'tzname': '+11', # pre-2017a, NCT ++ 'tzname': ['+11', 'NCT'], # pre-2017a, NCT + 'utcoffset': timedelta(hours=11), + 'dst': timedelta(0), + } +@@ -512,12 +514,12 @@ class NoumeaDSTEndTestCase(USEasternDSTStartTestCase): + tzinfo = pytz.timezone('Pacific/Noumea') + transition_time = datetime(1997, 3, 1, 15, 00, 00, tzinfo=UTC) + before = { +- 'tzname': '+12', # pre-2017a, NCST ++ 'tzname': ['+12', 'NCST'], # pre-2017a, NCST + 'utcoffset': timedelta(hours=12), + 'dst': timedelta(hours=1), + } + after = { +- 'tzname': '+11', # pre-2017a, NCT ++ 'tzname': ['+11', 'NCT'], # pre-2017a, NCT + 'utcoffset': timedelta(hours=11), + 'dst': timedelta(0), + } +@@ -541,7 +543,7 @@ class TahitiTestCase(USEasternDSTStartTestCase): + 'dst': timedelta(0), + } + after = { +- 'tzname': '-10', # pre-2017a, TAHT ++ 'tzname': ['-10', 'TAHT'], # pre-2017a, TAHT + 'utcoffset': timedelta(hours=-10), + 'dst': timedelta(0), + } +@@ -554,12 +556,12 @@ class SamoaInternationalDateLineChange(USEasternDSTStartTestCase): + tzinfo = pytz.timezone('Pacific/Apia') + transition_time = datetime(2011, 12, 30, 10, 0, 0, tzinfo=UTC) + before = { +- 'tzname': '-10', # pre-2017a, SDT ++ 'tzname': ['-10', 'SDT'], # pre-2017a, SDT + 'utcoffset': timedelta(hours=-10), + 'dst': timedelta(hours=1), + } + after = { +- 'tzname': '+14', # pre-2017a, WSDT ++ 'tzname': ['+14', 'WSDT'], # pre-2017a, WSDT + 'utcoffset': timedelta(hours=14), + 'dst': timedelta(hours=1), + } +@@ -612,7 +614,7 @@ class LocalTestCase(unittest.TestCase): + + 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') ++ self.assertIn(loc_time.strftime('%Z%z'), ['NET+0020', '+0020+0020']) + + loc_time = loc_tz.localize(datetime(1940, 5, 20, 0, 0, 0)) + self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200') +-- +2.13.1 + diff --git a/python-pytz.changes b/python-pytz.changes index 9ed35c1..ffe24eb 100644 --- a/python-pytz.changes +++ b/python-pytz.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jun 28 12:07:24 UTC 2017 - tbechtold@suse.com + +- add 0001-Fix-tests-for-older-timezone-versions.patch . This fixes + the tests on SLE12SP2 and SLE12SP3 + ------------------------------------------------------------------- Wed Apr 5 15:17:50 UTC 2017 - jmatejek@suse.com diff --git a/python-pytz.spec b/python-pytz.spec index c2870f3..5cc2fad 100644 --- a/python-pytz.spec +++ b/python-pytz.spec @@ -32,6 +32,8 @@ Source90: pytz.keyring Patch0: fix-tests.patch # PATCH-FEATURE-OPENSUSE -- Use system tz database (Olson database) Patch1: system_zoneinfo.patch +# PATCH-FIX-UPSTREAM 0001-Fix-tests-for-older-timezone-versions.patch -- https://code.launchpad.net/~toabctl/pytz/+git/pytz/+merge/326419 +Patch2: 0001-Fix-tests-for-older-timezone-versions.patch BuildRequires: %{python_module devel} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -65,6 +67,7 @@ Amost all of the Olson timezones are supported. %patch0 -p1 # Use system tz database %patch1 -p1 +%patch2 -p2 # For rpmlint warning: remove shebang from python library: sed -i '/^#!/d' ./pytz/tzfile.py