- Replace nose test runner with pytest (py2k stdlib unittest

runner is not sufficient to run the test suite here).
- Refresh patches fix-tests.patch, system_zoneinfo.patch,
  0001-Fix-tests-for-older-timezone-versions.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pytz?expand=0&rev=73
This commit is contained in:
Matej Cepl 2019-01-09 17:21:14 +00:00 committed by Git OBS Bridge
parent 80371ec27c
commit f0feb071a7
5 changed files with 30 additions and 34 deletions

View File

@ -8,11 +8,9 @@ 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
@@ -249,13 +249,14 @@ class USEasternDSTStartTestCase(unittest.TestCase):
--- a/pytz/tests/test_tzinfo.py
+++ b/pytz/tests/test_tzinfo.py
@@ -247,12 +247,13 @@ class USEasternDSTStartTestCase(unittest
def _test_tzname(self, utc_dt, wanted):
tzname = wanted['tzname']
@ -24,16 +22,14 @@ index 3166322..0ecb8c0 100644
- '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']
@@ -512,7 +514,7 @@ class NoumeaHistoryStartTestCase(USEasternDSTStartTestCase):
@@ -510,7 +511,7 @@ class NoumeaHistoryStartTestCase(USEaste
'dst': timedelta(0),
}
after = {
@ -42,7 +38,7 @@ index 3166322..0ecb8c0 100644
'utcoffset': timedelta(hours=11),
'dst': timedelta(0),
}
@@ -523,12 +525,12 @@ class NoumeaDSTEndTestCase(USEasternDSTStartTestCase):
@@ -521,12 +522,12 @@ class NoumeaDSTEndTestCase(USEasternDSTS
tzinfo = pytz.timezone('Pacific/Noumea')
transition_time = datetime(1997, 3, 1, 15, 00, 00, tzinfo=UTC)
before = {
@ -57,7 +53,7 @@ index 3166322..0ecb8c0 100644
'utcoffset': timedelta(hours=11),
'dst': timedelta(0),
}
@@ -552,7 +554,7 @@ class TahitiTestCase(USEasternDSTStartTestCase):
@@ -550,7 +551,7 @@ class TahitiTestCase(USEasternDSTStartTe
'dst': timedelta(0),
}
after = {
@ -66,7 +62,7 @@ index 3166322..0ecb8c0 100644
'utcoffset': timedelta(hours=-10),
'dst': timedelta(0),
}
@@ -565,12 +567,12 @@ class SamoaInternationalDateLineChange(USEasternDSTStartTestCase):
@@ -563,12 +564,12 @@ class SamoaInternationalDateLineChange(U
tzinfo = pytz.timezone('Pacific/Apia')
transition_time = datetime(2011, 12, 30, 10, 0, 0, tzinfo=UTC)
before = {
@ -81,7 +77,7 @@ index 3166322..0ecb8c0 100644
'utcoffset': timedelta(hours=14),
'dst': timedelta(hours=1),
}
@@ -620,7 +622,7 @@ class LocalTestCase(unittest.TestCase):
@@ -618,7 +619,7 @@ class LocalTestCase(unittest.TestCase):
loc_time = loc_tz.localize(datetime(1940, 5, 10, 0, 0, 0))
# pre-2017a, abbreviation was NCT
@ -90,6 +86,3 @@ index 3166322..0ecb8c0 100644
loc_time = loc_tz.localize(datetime(1940, 5, 20, 0, 0, 0))
self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200')
--
2.13.1

View File

@ -1,6 +1,6 @@
--- a/pytz/tests/test_tzinfo.py
+++ b/pytz/tests/test_tzinfo.py
@@ -728,15 +728,6 @@
@@ -726,15 +726,6 @@ class LocalTestCase(unittest.TestCase):
'1914-01-01 13:40:00 UTC+0000'
)

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Jan 9 18:18:15 CET 2019 - mcepl@suse.com
- Replace nose test runner with pytest (py2k stdlib unittest
runner is not sufficient to run the test suite here).
- Refresh patches fix-tests.patch, system_zoneinfo.patch,
0001-Fix-tests-for-older-timezone-versions.patch
-------------------------------------------------------------------
Tue Dec 4 12:53:18 UTC 2018 - Matej Cepl <mcepl@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-pytz
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -34,8 +34,11 @@ Patch0: fix-tests.patch
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 base}
# pytest is required only because of 2.7 stdlib test runner, python3
# unittest runner is sufficient.
BuildRequires: %{python_module pytest}
# Test requirements
BuildRequires: %{python_module nose}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: timezone
@ -59,11 +62,7 @@ Amost all of the Olson timezones are supported.
%prep
%setup -q -n pytz-%{version}
# Disable test which is not working (and documented so)
%patch0 -p1
# Use system tz database
%patch1 -p1
%patch2 -p2
%autopatch -p1
# For rpmlint warning: remove shebang from python library:
sed -i '/^#!/d' ./pytz/tzfile.py
@ -76,7 +75,7 @@ sed -i '/^#!/d' ./pytz/tzfile.py
%python_expand rm -fr %{buildroot}%{$python_sitelib}/pytz/zoneinfo
%check
%python_expand nosetests-%{$python_bin_suffix}
%python_expand PYTHONPATH=. py.test-%{$python_bin_suffix} -v pytz/tests
%files %{python_files}
%license LICENSE.txt

View File

@ -1,8 +1,6 @@
Index: pytz-2016.10/pytz/__init__.py
===================================================================
--- pytz-2016.10.orig/pytz/__init__.py
+++ pytz-2016.10/pytz/__init__.py
@@ -90,23 +90,7 @@ def open_resource(name):
--- a/pytz/__init__.py
+++ b/pytz/__init__.py
@@ -87,23 +87,7 @@ def open_resource(name):
for part in name_parts:
if part == os.path.pardir or os.path.sep in part:
raise ValueError('Bad path segment: %r' % part)
@ -27,10 +25,8 @@ Index: pytz-2016.10/pytz/__init__.py
return open(filename, 'rb')
Index: pytz-2016.10/pytz/tzfile.py
===================================================================
--- pytz-2016.10.orig/pytz/tzfile.py
+++ pytz-2016.10/pytz/tzfile.py
--- a/pytz/tzfile.py
+++ b/pytz/tzfile.py
@@ -126,7 +126,7 @@ def build_tzinfo(zone, fp):
if __name__ == '__main__':
import os.path