From 89d50010f275a9b626c28dee5c9d8cab45d541f8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 27 Jul 2017 11:31:05 +0000 Subject: [PATCH 01/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 052cabf..b851bb2 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -8,7 +8,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -90,6 +90,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Thu Jul 27 2017 Fedora Release Engineering - 1.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + * Sat Feb 11 2017 Fedora Release Engineering - 1.0-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild From 94a1fbb3b9ed1b7dace146b244f0af6df5176f3d Mon Sep 17 00:00:00 2001 From: Iryna Shcherbina Date: Sat, 27 Jan 2018 02:36:15 +0100 Subject: [PATCH 02/46] Update Python 2 dependency declarations to new packaging standards --- python-pyrfc3339.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index b851bb2..0e4e6f6 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -8,7 +8,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -18,8 +18,8 @@ Source0: https://pypi.python.org/packages/source/p/pyRFC3339/pyRFC3339-%{ BuildArch: noarch BuildRequires: python2-devel # --- unit tests --- -BuildRequires: python-nose -BuildRequires: pytz +BuildRequires: python2-nose +BuildRequires: python2-pytz %if %{with python3} BuildRequires: python3-devel @@ -90,6 +90,10 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Sat Jan 27 2018 Iryna Shcherbina - 1.0-8 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + * Thu Jul 27 2017 Fedora Release Engineering - 1.0-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild From 6193b225a60ca6c84697142720b640ea4992975f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 9 Feb 2018 10:13:15 +0000 Subject: [PATCH 03/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 0e4e6f6..052646a 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -8,7 +8,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -90,6 +90,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Fri Feb 09 2018 Fedora Release Engineering - 1.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Sat Jan 27 2018 Iryna Shcherbina - 1.0-8 - Update Python 2 dependency declarations to new packaging standards (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) From fcbe58959da2393bdaa18381c983d25464e2e800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 19 Jun 2018 11:15:34 +0200 Subject: [PATCH 04/46] Rebuilt for Python 3.7 --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 052646a..94d11f6 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -8,7 +8,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -90,6 +90,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Tue Jun 19 2018 Miro Hrončok - 1.0-10 +- Rebuilt for Python 3.7 + * Fri Feb 09 2018 Fedora Release Engineering - 1.0-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild From cd609a5f56a9069d361b03d7bd73cb6d600a5c8e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 14 Jul 2018 01:41:23 +0000 Subject: [PATCH 05/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 94d11f6..8ea65ff 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -8,7 +8,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -90,6 +90,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Sat Jul 14 2018 Fedora Release Engineering - 1.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Tue Jun 19 2018 Miro Hrončok - 1.0-10 - Rebuilt for Python 3.7 From 3445b5bc6bfbe5903b25049513f1356248a31836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 9 Jan 2019 13:11:38 +0100 Subject: [PATCH 06/46] Subpackage python2-pyrfc3339 has been removed --- python-pyrfc3339.spec | 44 +++++-------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 8ea65ff..b169ba3 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -1,14 +1,9 @@ %global srcname pyRFC3339 -%if 0%{?fedora} -%bcond_without python3 -%else -%bcond_with python3 -%endif Name: python-pyrfc3339 Version: 1.0 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -16,31 +11,16 @@ URL: https://pypi.python.org/pypi/pyRFC3339 Source0: https://pypi.python.org/packages/source/p/pyRFC3339/pyRFC3339-%{version}.tar.gz BuildArch: noarch -BuildRequires: python2-devel -# --- unit tests --- -BuildRequires: python2-nose -BuildRequires: python2-pytz -%if %{with python3} BuildRequires: python3-devel # --- unit tests --- BuildRequires: python3-nose BuildRequires: python3-pytz -%endif %description This package contains a python library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. -%package -n python2-pyrfc3339 -Summary: %{summary} -%{?python_provide:%python_provide python2-pyrfc3339} - -%description -n python2-pyrfc3339 -This package contains a Python 2 library to parse and generate -RFC 3339-compliant timestamps using Python datetime.datetime objects. - -%if %{with python3} %package -n python3-pyrfc3339 Summary: Generate and parse RFC 3339 timestamps %{?python_provide:%python_provide python3-pyrfc3339} @@ -48,7 +28,6 @@ Summary: Generate and parse RFC 3339 timestamps %description -n python3-pyrfc3339 This package contains a Python 3 library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. -%endif @@ -56,40 +35,27 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %autosetup -n %{srcname}-%{version} %build -%py2_build -%if %{with python3} %py3_build -%endif %install -%py2_install -%if %{with python3} %py3_install -%endif %check -%{__python2} setup.py test -%if %{with python3} %{__python3} setup.py test -%endif -%files -n python2-pyrfc3339 -%doc README.rst -%license LICENSE.txt -%{python2_sitelib}/pyrfc3339 -%{python2_sitelib}/%{srcname}-%{version}-*.egg-info - -%if %{with python3} %files -n python3-pyrfc3339 %doc README.rst %license LICENSE.txt %{python3_sitelib}/pyrfc3339 %{python3_sitelib}/%{srcname}-%{version}-*.egg-info -%endif %changelog +* Wed Jan 09 2019 Miro Hrončok - 1.0-12 +- Subpackage python2-pyrfc3339 has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + * Sat Jul 14 2018 Fedora Release Engineering - 1.0-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From 8a0a67bb02f92a7f8d83afde73e1f7c8c8f6f21a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 2 Feb 2019 08:44:33 +0000 Subject: [PATCH 07/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index b169ba3..07babc3 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -3,7 +3,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -52,6 +52,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Sat Feb 02 2019 Fedora Release Engineering - 1.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Wed Jan 09 2019 Miro Hrončok - 1.0-12 - Subpackage python2-pyrfc3339 has been removed See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal From 28d8f59d3ac0b737397bdc366dd8fc87a670d09d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 26 Jul 2019 15:38:39 +0000 Subject: [PATCH 08/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 07babc3..9bdb7c3 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -3,7 +3,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -52,6 +52,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Fri Jul 26 2019 Fedora Release Engineering - 1.0-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Sat Feb 02 2019 Fedora Release Engineering - 1.0-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild From 713e875e456802da6c1e77ef96ebb87644c72a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 19 Aug 2019 10:52:45 +0200 Subject: [PATCH 09/46] Rebuilt for Python 3.8 --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 9bdb7c3..07bd60d 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -3,7 +3,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -52,6 +52,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Mon Aug 19 2019 Miro Hrončok - 1.0-15 +- Rebuilt for Python 3.8 + * Fri Jul 26 2019 Fedora Release Engineering - 1.0-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild From ec92b054d061424b2b11c867528aea679a0e1ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 3 Oct 2019 14:25:59 +0200 Subject: [PATCH 10/46] Rebuilt for Python 3.8.0rc1 (#1748018) --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 07bd60d..bed6b29 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -3,7 +3,7 @@ Name: python-pyrfc3339 Version: 1.0 -Release: 15%{?dist} +Release: 16%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -52,6 +52,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Thu Oct 03 2019 Miro Hrončok - 1.0-16 +- Rebuilt for Python 3.8.0rc1 (#1748018) + * Mon Aug 19 2019 Miro Hrončok - 1.0-15 - Rebuilt for Python 3.8 From 6690e5f1e8524bcabd2d4ced578f1976e50d66a8 Mon Sep 17 00:00:00 2001 From: Eli Young Date: Tue, 8 Oct 2019 12:18:35 -0700 Subject: [PATCH 11/46] Update to 1.1 (#1697425) --- .gitignore | 1 + python-pyrfc3339.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 367e24f..b0426c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /pyRFC3339-1.0.tar.gz +/pyRFC3339-1.1.tar.gz diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index bed6b29..2b4c2b6 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,8 +2,8 @@ Name: python-pyrfc3339 -Version: 1.0 -Release: 16%{?dist} +Version: 1.1 +Release: 1%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -52,6 +52,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Tue Oct 08 2019 Eli Young - 1.1-1 +- Update to 1.1 (#1697425) + * Thu Oct 03 2019 Miro Hrončok - 1.0-16 - Rebuilt for Python 3.8.0rc1 (#1748018) diff --git a/sources b/sources index d5a585d..8423dc9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0f7edd7ffd756a582eeef9282fecb60d pyRFC3339-1.0.tar.gz +SHA512 (pyRFC3339-1.1.tar.gz) = 958b7761fab590aa42bb57a955c5d834441f717796a452b60df21663099dcf2fc046afe60f8157fd0f1edfd95c5e9c9c5349ab10ca4078d210fc63d848496a2f From 3a4b67daf83121d8f6a5d9bcd6799198a988c29c Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Tue, 3 Dec 2019 08:30:53 -0600 Subject: [PATCH 12/46] "Adding package.cfg file" --- package.cfg | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 package.cfg diff --git a/package.cfg b/package.cfg new file mode 100644 index 0000000..66ea79d --- /dev/null +++ b/package.cfg @@ -0,0 +1,2 @@ +[koji] +targets = epel8 epel8-playground \ No newline at end of file From 35b29f175f7ab0166dc2da1163aecd38c964d48f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 30 Jan 2020 14:34:44 +0000 Subject: [PATCH 13/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 2b4c2b6..7427f5c 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -3,7 +3,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -52,6 +52,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %changelog +* Thu Jan 30 2020 Fedora Release Engineering - 1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Tue Oct 08 2019 Eli Young - 1.1-1 - Update to 1.1 (#1697425) From c63d5f3e3c94c1f5bcd4ad0007ae259d70282882 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 14 Apr 2020 15:00:28 +0200 Subject: [PATCH 14/46] Add package.cfg with no targets This prevents warnings about a missing package.cfg in EPEL 8 but enables us to keep all branches in sync (fast-forward merging). --- package.cfg | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 package.cfg diff --git a/package.cfg b/package.cfg new file mode 100644 index 0000000..3f45895 --- /dev/null +++ b/package.cfg @@ -0,0 +1,2 @@ +[koji] +targets = From acaecc0929e7504fc3c965caff3dcd7495d4426f Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 14 Apr 2020 15:37:55 +0200 Subject: [PATCH 15/46] use "%{pypi_source}" --- python-pyrfc3339.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 7427f5c..f346c1f 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -8,7 +8,7 @@ Summary: Generate and parse RFC 3339 timestamps License: MIT URL: https://pypi.python.org/pypi/pyRFC3339 -Source0: https://pypi.python.org/packages/source/p/pyRFC3339/pyRFC3339-%{version}.tar.gz +Source0: %{pypi_source} BuildArch: noarch From 89367f7aa88f3f9a061fa5b1e722947def7e2436 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 14 Apr 2020 15:47:59 +0200 Subject: [PATCH 16/46] also package+run unit tests --- python-pyrfc3339.spec | 14 +++- tests.py | 170 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+), 3 deletions(-) create mode 100644 tests.py diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index f346c1f..14772b2 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -3,12 +3,16 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT URL: https://pypi.python.org/pypi/pyRFC3339 Source0: %{pypi_source} +# release tarballs do not contain unit tests (pyrfc3339/tests/tests.py) +# https://raw.githubusercontent.com/kurtraschke/pyRFC3339/master/pyrfc3339/tests/tests.py +# v1.1: git commit e30cc155 +Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc1555adce0ecc7bd65509a2249d47e5a41b4/pyrfc3339/tests/tests.py BuildArch: noarch @@ -41,17 +45,21 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %py3_install %check -%{__python3} setup.py test +cp -a %{SOURCE1} . +nosetests-%{python3_version} tests.py %files -n python3-pyrfc3339 %doc README.rst -%license LICENSE.txt +%license LICENSE.txt %{python3_sitelib}/pyrfc3339 %{python3_sitelib}/%{srcname}-%{version}-*.egg-info %changelog +* Tue Apr 14 2020 Felix Schwarz - 1.1-3 +- also package+run unit tests + * Thu Jan 30 2020 Fedora Release Engineering - 1.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..831daab --- /dev/null +++ b/tests.py @@ -0,0 +1,170 @@ +''' +Test suite for pyRFC3339. + +''' + +from datetime import datetime +from copy import deepcopy + +from pyrfc3339 import generate, parse +from pyrfc3339.utils import timezone +import pytz + +from nose.tools import eq_, raises + + +class TestCore(): + ''' + This test suite contains tests to address cases not tested in the doctests, + as well as additional tests for end-to-end verification. + + ''' + def test_timezone_rounding(self): + ''' + Test rounding of timezone values to the nearest second. + + ''' + eq_(timezone(5429), '+01:30') + eq_(timezone(5431), '+01:31') + + def test_zero_offset(self): + ''' + Both +00:00 and -00:00 are equivalent to the offset 'Z' (UTC). + + ''' + timestamp = '2009-01-01T10:02:03+00:00' + dt = parse(timestamp) + eq_(dt.tzinfo, pytz.utc) + + timestamp = '2009-01-01T10:02:03-00:00' + dt = parse(timestamp) + eq_(dt.tzinfo, pytz.utc) + + def test_deepcopy(self): + ''' + Tests that deepcopy works and doesn't crash + + ''' + timestamp = '2009-01-01T10:02:03+02:00' + dt = parse(timestamp) + deepcopy(dt) + + def test_parse_microseconds(self): + ''' + Test parsing timestamps with microseconds. + + ''' + timestamp = '2009-01-01T10:02:03.25Z' + dt = parse(timestamp) + eq_(dt.microsecond, 250000) + + def test_generate_microseconds(self): + ''' + Test generating timestamps with microseconds. + + ''' + dt = datetime(2009, 1, 1, 10, 2, 3, 500000, pytz.utc) + timestamp = generate(dt, microseconds=True) + eq_(timestamp, '2009-01-01T10:02:03.500000Z') + + def test_mixed_case(self): + ''' + Timestamps may use either 'T' or 't' and either 'Z' or 'z' + according to :RFC:`3339`. + + ''' + dt1 = parse('2009-01-01t10:01:02z') + dt2 = datetime(2009, 1, 1, 10, 1, 2, tzinfo=pytz.utc) + + eq_(dt1, dt2) + + def test_parse_naive_utc(self): + ''' + Test parsing a UTC timestamp to a naive datetime. + + ''' + dt1 = parse('2009-01-01T10:01:02Z', produce_naive=True) + eq_(dt1.tzinfo, None) + + @raises(ValueError) + def test_parse_naive_local(self): + ''' + Test that parsing a local timestamp to a naive datetime fails. + + ''' + parse('2009-01-01T10:01:02-04:00', produce_naive=True) + + def test_generate_utc_parse_utc(self): + ''' + Generate a UTC timestamp and parse it into a UTC datetime. + + ''' + dt1 = datetime.utcnow() + dt1 = dt1.replace(tzinfo=pytz.utc) + + dt2 = parse(generate(dt1, microseconds=True)) + eq_(dt1, dt2) + + def test_generate_local_parse_local(self): + ''' + Generate a local timestamp and parse it into a local datetime. + + ''' + eastern = pytz.timezone('US/Eastern') + dt1 = eastern.localize(datetime.utcnow()) + dt2 = parse(generate(dt1, utc=False, microseconds=True), utc=False) + eq_(dt1, dt2) + + def test_generate_local_parse_utc(self): + ''' + Generate a local timestamp and parse it into a UTC datetime. + + ''' + eastern = pytz.timezone('US/Eastern') + dt1 = eastern.localize(datetime.utcnow()) + dt2 = parse(generate(dt1, utc=False, microseconds=True)) + eq_(dt1, dt2) + + +class TestExhaustiveRoundtrip(): + ''' + This test suite exhaustively tests parsing and generation by generating + a local RFC 3339 timestamp for every timezone supported by pytz, + and parsing that timestamp into a local datetime and a UTC datetime. + ''' + + slow = True + + def test_local_roundtrip(self): + for tz_name in pytz.all_timezones: + yield self.local_roundtrip, tz_name + + def local_roundtrip(self, tz_name): + ''' + Generates a local datetime using the given timezone, + produces a local timestamp from the datetime, parses the timestamp + to a local datetime, and verifies that the two datetimes are equal. + + ''' + tzinfo = pytz.timezone(tz_name) + dt1 = tzinfo.localize(datetime.utcnow()) + timestamp = generate(dt1, utc=False, microseconds=True) + dt2 = parse(timestamp, utc=False) + eq_(dt1, dt2) + + def test_utc_roundtrip(self): + for tz_name in pytz.all_timezones: + yield self.utc_roundtrip, tz_name + + def utc_roundtrip(self, tz_name): + ''' + Generates a local datetime using the given timezone, + produces a local timestamp from the datetime, parses the timestamp + to a UTC datetime, and verifies that the two datetimes are equal. + + ''' + tzinfo = pytz.timezone(tz_name) + dt1 = tzinfo.localize(datetime.utcnow()) + timestamp = generate(dt1, utc=False, microseconds=True) + dt2 = parse(timestamp) + eq_(dt1, dt2) From 5faf74ba0cb4c8e6e479930ec98a5dfefa491ca1 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Tue, 14 Apr 2020 16:06:48 +0200 Subject: [PATCH 17/46] build Python 3 subpackage also in EPEL 7 --- python-pyrfc3339.spec | 53 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 14772b2..15a0d46 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -1,5 +1,11 @@ %global srcname pyRFC3339 +%if 0%{?rhel} && (0%{?rhel} <= 7) +%bcond_without python2 +%else +%bcond_with python2 +%endif +%global py3_prefix python%{python3_pkgversion} Name: python-pyrfc3339 Version: 1.1 @@ -15,21 +21,37 @@ Source0: %{pypi_source} Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc1555adce0ecc7bd65509a2249d47e5a41b4/pyrfc3339/tests/tests.py BuildArch: noarch - -BuildRequires: python3-devel +%if %{with python2} +BuildRequires: python2-devel # --- unit tests --- -BuildRequires: python3-nose -BuildRequires: python3-pytz +BuildRequires: python-nose +BuildRequires: pytz +%endif + +BuildRequires: %{py3_prefix}-devel +# --- unit tests --- +BuildRequires: %{py3_prefix}-nose +BuildRequires: %{py3_prefix}-pytz %description This package contains a python library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. -%package -n python3-pyrfc3339 +%if %{with python2} +%package -n python2-pyrfc3339 +Summary: %{summary} +%{?python_provide:%python_provide python2-pyrfc3339} + +%description -n python2-pyrfc3339 +This package contains a Python 2 library to parse and generate +RFC 3339-compliant timestamps using Python datetime.datetime objects. +%endif + +%package -n %{py3_prefix}-pyrfc3339 Summary: Generate and parse RFC 3339 timestamps %{?python_provide:%python_provide python3-pyrfc3339} -%description -n python3-pyrfc3339 +%description -n %{py3_prefix}-pyrfc3339 This package contains a Python 3 library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. @@ -39,17 +61,33 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %autosetup -n %{srcname}-%{version} %build +%if %{with python2} +%py2_build +%endif %py3_build %install +%if %{with python2} +%py2_install +%endif %py3_install %check cp -a %{SOURCE1} . +%if %{with python2} +nosetests-2.7 tests.py +%endif nosetests-%{python3_version} tests.py +%if %{with python2} +%files -n python2-pyrfc3339 +%doc README.rst +%license LICENSE.txt +%{python2_sitelib}/pyrfc3339 +%{python2_sitelib}/%{srcname}-%{version}-*.egg-info +%endif -%files -n python3-pyrfc3339 +%files -n %{py3_prefix}-pyrfc3339 %doc README.rst %license LICENSE.txt %{python3_sitelib}/pyrfc3339 @@ -59,6 +97,7 @@ nosetests-%{python3_version} tests.py %changelog * Tue Apr 14 2020 Felix Schwarz - 1.1-3 - also package+run unit tests +- build Python 3 subpackage also in EPEL 7 * Thu Jan 30 2020 Fedora Release Engineering - 1.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From a59a674eda6cdd412162457a7d4d1063ee160304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 26 May 2020 03:34:15 +0200 Subject: [PATCH 18/46] Rebuilt for Python 3.9 --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 15a0d46..e8a37ee 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -9,7 +9,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -95,6 +95,9 @@ nosetests-%{python3_version} tests.py %changelog +* Tue May 26 2020 Miro Hrončok - 1.1-4 +- Rebuilt for Python 3.9 + * Tue Apr 14 2020 Felix Schwarz - 1.1-3 - also package+run unit tests - build Python 3 subpackage also in EPEL 7 From 11b3842a1f2d1db0a5b17b719820a09b74cf72a1 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Thu, 25 Jun 2020 10:14:51 +0200 Subject: [PATCH 19/46] add python-setuptools to BuildRequires --- python-pyrfc3339.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index e8a37ee..51dd36f 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -9,7 +9,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -23,12 +23,14 @@ Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc155 BuildArch: noarch %if %{with python2} BuildRequires: python2-devel +BuildRequires: python-setuptools # --- unit tests --- BuildRequires: python-nose BuildRequires: pytz %endif BuildRequires: %{py3_prefix}-devel +BuildRequires: %{py3_prefix}-setuptools # --- unit tests --- BuildRequires: %{py3_prefix}-nose BuildRequires: %{py3_prefix}-pytz @@ -95,6 +97,9 @@ nosetests-%{python3_version} tests.py %changelog +* Thu Jun 25 2020 Felix Schwarz - 1.1-5 +- add python-setuptools to BuildRequires + * Tue May 26 2020 Miro Hrončok - 1.1-4 - Rebuilt for Python 3.9 From 02088af4dc046844593a8357bd9a294a5eb23411 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jul 2020 03:14:32 +0000 Subject: [PATCH 20/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 51dd36f..080439b 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -9,7 +9,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -97,6 +97,9 @@ nosetests-%{python3_version} tests.py %changelog +* Wed Jul 29 2020 Fedora Release Engineering - 1.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Thu Jun 25 2020 Felix Schwarz - 1.1-5 - add python-setuptools to BuildRequires From 790ddb50ac252516bd8a73e77d2ff17806c322a0 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Thu, 24 Sep 2020 16:33:12 +0000 Subject: [PATCH 21/46] remove package.cfg per new epel-playground policy --- package.cfg | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 package.cfg diff --git a/package.cfg b/package.cfg deleted file mode 100644 index 3f45895..0000000 --- a/package.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[koji] -targets = From 7f2bbb0c9b1a716aedf42347f6a98f86de049861 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 27 Jan 2021 12:45:09 +0000 Subject: [PATCH 22/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 080439b..d5bb68c 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -9,7 +9,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -97,6 +97,9 @@ nosetests-%{python3_version} tests.py %changelog +* Wed Jan 27 2021 Fedora Release Engineering - 1.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Wed Jul 29 2020 Fedora Release Engineering - 1.1-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 5916527741f15b33790e11863f02900810759ac9 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 4 Jun 2021 20:55:23 +0200 Subject: [PATCH 23/46] Rebuilt for Python 3.10 --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index d5bb68c..f5ca411 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -9,7 +9,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -97,6 +97,9 @@ nosetests-%{python3_version} tests.py %changelog +* Fri Jun 04 2021 Python Maint - 1.1-8 +- Rebuilt for Python 3.10 + * Wed Jan 27 2021 Fedora Release Engineering - 1.1-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild From 4ecd929b937bd358f3ea95fc26a725bf448a611d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 23 Jul 2021 08:46:05 +0000 Subject: [PATCH 24/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index f5ca411..d3adb18 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -9,7 +9,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -97,6 +97,9 @@ nosetests-%{python3_version} tests.py %changelog +* Fri Jul 23 2021 Fedora Release Engineering - 1.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Fri Jun 04 2021 Python Maint - 1.1-8 - Rebuilt for Python 3.10 From f6aca1436696e178bc43d83489fa71a900728050 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 21 Jan 2022 14:44:03 +0000 Subject: [PATCH 25/46] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index d3adb18..fcfbe30 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -9,7 +9,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -97,6 +97,9 @@ nosetests-%{python3_version} tests.py %changelog +* Fri Jan 21 2022 Fedora Release Engineering - 1.1-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Fri Jul 23 2021 Fedora Release Engineering - 1.1-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From a863d1a3c90944b90685680af4dad5d8c7dbc0da Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Fri, 28 Jan 2022 16:42:42 -0500 Subject: [PATCH 26/46] Converted tests from python-nose to pytest --- python-pyrfc3339.spec | 15 +++++--- tests.py | 85 ++++++++++++++++++++++++------------------- 2 files changed, 57 insertions(+), 43 deletions(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index fcfbe30..25bd414 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -9,7 +9,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -25,14 +25,14 @@ BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setuptools # --- unit tests --- -BuildRequires: python-nose +BuildRequires: pytest BuildRequires: pytz %endif BuildRequires: %{py3_prefix}-devel BuildRequires: %{py3_prefix}-setuptools # --- unit tests --- -BuildRequires: %{py3_prefix}-nose +BuildRequires: %{py3_prefix}-pytest BuildRequires: %{py3_prefix}-pytz %description @@ -77,9 +77,11 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %check cp -a %{SOURCE1} . %if %{with python2} -nosetests-2.7 tests.py +py.test-2.7 -v tests.py +pytest-3 -v tests.py +%else +%pytest -v tests.py %endif -nosetests-%{python3_version} tests.py %if %{with python2} %files -n python2-pyrfc3339 @@ -97,6 +99,9 @@ nosetests-%{python3_version} tests.py %changelog +* Fri Jan 28 2022 Matthew Davis - 1.1-11 +- Converted tests from python-nose to pytest + * Fri Jan 21 2022 Fedora Release Engineering - 1.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/tests.py b/tests.py index 831daab..d4c7622 100644 --- a/tests.py +++ b/tests.py @@ -8,12 +8,11 @@ from copy import deepcopy from pyrfc3339 import generate, parse from pyrfc3339.utils import timezone +import unittest +import pytest import pytz -from nose.tools import eq_, raises - - -class TestCore(): +class TestCore(unittest.TestCase): ''' This test suite contains tests to address cases not tested in the doctests, as well as additional tests for end-to-end verification. @@ -24,8 +23,11 @@ class TestCore(): Test rounding of timezone values to the nearest second. ''' - eq_(timezone(5429), '+01:30') - eq_(timezone(5431), '+01:31') + if not timezone(5429) == '+01:30': + raise AssertionError("%r != %r" % (timezone(5429), '+01:30')) + + if not timezone(5431) == '+01:31': + raise AssertionError("%r != %r" % (timezone(5431), '+01:31')) def test_zero_offset(self): ''' @@ -34,11 +36,13 @@ class TestCore(): ''' timestamp = '2009-01-01T10:02:03+00:00' dt = parse(timestamp) - eq_(dt.tzinfo, pytz.utc) + if not dt.tzinfo == pytz.utc: + raise AssertionError("%r != %r" % (dt.tzinfo, pytz.utc)) timestamp = '2009-01-01T10:02:03-00:00' dt = parse(timestamp) - eq_(dt.tzinfo, pytz.utc) + if not dt.tzinfo == pytz.utc: + raise AssertionError("%r != %r" % (dt.tzinfo, pytz.utc)) def test_deepcopy(self): ''' @@ -56,7 +60,8 @@ class TestCore(): ''' timestamp = '2009-01-01T10:02:03.25Z' dt = parse(timestamp) - eq_(dt.microsecond, 250000) + if not dt.microsecond == 250000: + raise AssertionError("%r != %r" % (dt.microsecond, 250000)) def test_generate_microseconds(self): ''' @@ -65,7 +70,8 @@ class TestCore(): ''' dt = datetime(2009, 1, 1, 10, 2, 3, 500000, pytz.utc) timestamp = generate(dt, microseconds=True) - eq_(timestamp, '2009-01-01T10:02:03.500000Z') + if not timestamp == '2009-01-01T10:02:03.500000Z': + raise AssertionError("%r != %r" % (timestamp, '2009-01-01T10:02:03.500000Z')) def test_mixed_case(self): ''' @@ -76,7 +82,8 @@ class TestCore(): dt1 = parse('2009-01-01t10:01:02z') dt2 = datetime(2009, 1, 1, 10, 1, 2, tzinfo=pytz.utc) - eq_(dt1, dt2) + if not dt1 == dt2: + raise AssertionError("%r != %r" % (dt1, dt2)) def test_parse_naive_utc(self): ''' @@ -84,15 +91,17 @@ class TestCore(): ''' dt1 = parse('2009-01-01T10:01:02Z', produce_naive=True) - eq_(dt1.tzinfo, None) + if not dt1.tzinfo == None: + raise AssertionError("%r != %r" % (dt1.tzinfo, None)) - @raises(ValueError) def test_parse_naive_local(self): ''' Test that parsing a local timestamp to a naive datetime fails. ''' - parse('2009-01-01T10:01:02-04:00', produce_naive=True) + with self.assertRaises(ValueError) as context: + parse('2009-01-01T10:01:02-04:00', produce_naive=True) + def test_generate_utc_parse_utc(self): ''' @@ -103,7 +112,8 @@ class TestCore(): dt1 = dt1.replace(tzinfo=pytz.utc) dt2 = parse(generate(dt1, microseconds=True)) - eq_(dt1, dt2) + if not dt1 == dt2: + raise AssertionError("%r != %r" % (dt1, dt2)) def test_generate_local_parse_local(self): ''' @@ -113,7 +123,8 @@ class TestCore(): eastern = pytz.timezone('US/Eastern') dt1 = eastern.localize(datetime.utcnow()) dt2 = parse(generate(dt1, utc=False, microseconds=True), utc=False) - eq_(dt1, dt2) + if not dt1 == dt2: + raise AssertionError("%r != %r" % (dt1, dt2)) def test_generate_local_parse_utc(self): ''' @@ -123,10 +134,12 @@ class TestCore(): eastern = pytz.timezone('US/Eastern') dt1 = eastern.localize(datetime.utcnow()) dt2 = parse(generate(dt1, utc=False, microseconds=True)) - eq_(dt1, dt2) + if not dt1 == dt2: + raise AssertionError("%r != %r" % (dt1, dt2)) -class TestExhaustiveRoundtrip(): +@pytest.mark.parametrize('tz_name', pytz.all_timezones) +class TestExhaustiveRoundtrip: ''' This test suite exhaustively tests parsing and generation by generating a local RFC 3339 timestamp for every timezone supported by pytz, @@ -135,36 +148,32 @@ class TestExhaustiveRoundtrip(): slow = True - def test_local_roundtrip(self): - for tz_name in pytz.all_timezones: - yield self.local_roundtrip, tz_name - - def local_roundtrip(self, tz_name): + def test_local_roundtrip(self, tz_name): ''' Generates a local datetime using the given timezone, produces a local timestamp from the datetime, parses the timestamp to a local datetime, and verifies that the two datetimes are equal. ''' - tzinfo = pytz.timezone(tz_name) - dt1 = tzinfo.localize(datetime.utcnow()) - timestamp = generate(dt1, utc=False, microseconds=True) - dt2 = parse(timestamp, utc=False) - eq_(dt1, dt2) + if not tz_name == 'leapseconds': + tzinfo = pytz.timezone(tz_name) + dt1 = tzinfo.localize(datetime.utcnow()) + timestamp = generate(dt1, utc=False, microseconds=True) + dt2 = parse(timestamp, utc=False) + if not dt1 == dt2: + raise AssertionError("%r != %r" % (dt1, dt2)) - def test_utc_roundtrip(self): - for tz_name in pytz.all_timezones: - yield self.utc_roundtrip, tz_name - - def utc_roundtrip(self, tz_name): + def test_utc_roundtrip(self, tz_name): ''' Generates a local datetime using the given timezone, produces a local timestamp from the datetime, parses the timestamp to a UTC datetime, and verifies that the two datetimes are equal. ''' - tzinfo = pytz.timezone(tz_name) - dt1 = tzinfo.localize(datetime.utcnow()) - timestamp = generate(dt1, utc=False, microseconds=True) - dt2 = parse(timestamp) - eq_(dt1, dt2) + if not tz_name == 'leapseconds': + tzinfo = pytz.timezone(tz_name) + dt1 = tzinfo.localize(datetime.utcnow()) + timestamp = generate(dt1, utc=False, microseconds=True) + dt2 = parse(timestamp) + if not dt1 == dt2: + raise AssertionError("%r != %r" % (dt1, dt2)) From 23b0bafb53816f54e710fad3744ce1a825ae5552 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Thu, 7 Apr 2022 18:46:22 -0400 Subject: [PATCH 27/46] Removed Python2 support Removed python2 support from specfile. --- python-pyrfc3339.spec | 44 +------------------------------------------ 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 25bd414..6977a98 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -1,10 +1,4 @@ %global srcname pyRFC3339 -%if 0%{?rhel} && (0%{?rhel} <= 7) -%bcond_without python2 -%else -%bcond_with python2 -%endif - %global py3_prefix python%{python3_pkgversion} Name: python-pyrfc3339 @@ -21,13 +15,6 @@ Source0: %{pypi_source} Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc1555adce0ecc7bd65509a2249d47e5a41b4/pyrfc3339/tests/tests.py BuildArch: noarch -%if %{with python2} -BuildRequires: python2-devel -BuildRequires: python-setuptools -# --- unit tests --- -BuildRequires: pytest -BuildRequires: pytz -%endif BuildRequires: %{py3_prefix}-devel BuildRequires: %{py3_prefix}-setuptools @@ -39,16 +26,6 @@ BuildRequires: %{py3_prefix}-pytz This package contains a python library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. -%if %{with python2} -%package -n python2-pyrfc3339 -Summary: %{summary} -%{?python_provide:%python_provide python2-pyrfc3339} - -%description -n python2-pyrfc3339 -This package contains a Python 2 library to parse and generate -RFC 3339-compliant timestamps using Python datetime.datetime objects. -%endif - %package -n %{py3_prefix}-pyrfc3339 Summary: Generate and parse RFC 3339 timestamps %{?python_provide:%python_provide python3-pyrfc3339} @@ -63,33 +40,14 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %autosetup -n %{srcname}-%{version} %build -%if %{with python2} -%py2_build -%endif %py3_build %install -%if %{with python2} -%py2_install -%endif %py3_install %check cp -a %{SOURCE1} . -%if %{with python2} -py.test-2.7 -v tests.py -pytest-3 -v tests.py -%else %pytest -v tests.py -%endif - -%if %{with python2} -%files -n python2-pyrfc3339 -%doc README.rst -%license LICENSE.txt -%{python2_sitelib}/pyrfc3339 -%{python2_sitelib}/%{srcname}-%{version}-*.egg-info -%endif %files -n %{py3_prefix}-pyrfc3339 %doc README.rst @@ -99,7 +57,7 @@ pytest-3 -v tests.py %changelog -* Fri Jan 28 2022 Matthew Davis - 1.1-11 +* Thu Apr 07 2022 Matthew Davis - 1.1-11 - Converted tests from python-nose to pytest * Fri Jan 21 2022 Fedora Release Engineering - 1.1-10 From 8a2315b0cffa60421e43014afd9c91b5f4e32de8 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Thu, 7 Apr 2022 22:08:49 -0400 Subject: [PATCH 28/46] Converted to pyproject macros Updated spec file to use pyproject macros --- python-pyrfc3339.spec | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 6977a98..f96fb60 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -17,10 +17,9 @@ Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc155 BuildArch: noarch BuildRequires: %{py3_prefix}-devel -BuildRequires: %{py3_prefix}-setuptools # --- unit tests --- +# Specified manually because upstream release tarballs do not contain unit tests BuildRequires: %{py3_prefix}-pytest -BuildRequires: %{py3_prefix}-pytz %description This package contains a python library to parse and generate @@ -34,31 +33,32 @@ Summary: Generate and parse RFC 3339 timestamps This package contains a Python 3 library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. +%generate_buildrequires +%pyproject_buildrequires %prep %autosetup -n %{srcname}-%{version} %build -%py3_build +%pyproject_wheel %install -%py3_install +%pyproject_install +%pyproject_save_files pyrfc3339 %check cp -a %{SOURCE1} . %pytest -v tests.py -%files -n %{py3_prefix}-pyrfc3339 +%files -n %{py3_prefix}-pyrfc3339 -f %{pyproject_files} %doc README.rst -%license LICENSE.txt -%{python3_sitelib}/pyrfc3339 -%{python3_sitelib}/%{srcname}-%{version}-*.egg-info - %changelog * Thu Apr 07 2022 Matthew Davis - 1.1-11 - Converted tests from python-nose to pytest +- Removed Python 2 support +- Converted to pyproject macros * Fri Jan 21 2022 Fedora Release Engineering - 1.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From 1aa127ca26f37aeec38dd7d5d75f8289c2f98d93 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Fri, 8 Apr 2022 22:29:18 +0200 Subject: [PATCH 29/46] replace "%{py3_prefix}" with "python3-" --- python-pyrfc3339.spec | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index f96fb60..96fc6b6 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -1,5 +1,4 @@ %global srcname pyRFC3339 -%global py3_prefix python%{python3_pkgversion} Name: python-pyrfc3339 Version: 1.1 @@ -16,20 +15,20 @@ Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc155 BuildArch: noarch -BuildRequires: %{py3_prefix}-devel +BuildRequires: python3-devel # --- unit tests --- # Specified manually because upstream release tarballs do not contain unit tests -BuildRequires: %{py3_prefix}-pytest +BuildRequires: python3-pytest %description This package contains a python library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. -%package -n %{py3_prefix}-pyrfc3339 +%package -n python3-pyrfc3339 Summary: Generate and parse RFC 3339 timestamps %{?python_provide:%python_provide python3-pyrfc3339} -%description -n %{py3_prefix}-pyrfc3339 +%description -n python3-pyrfc3339 This package contains a Python 3 library to parse and generate RFC 3339-compliant timestamps using Python datetime.datetime objects. @@ -51,7 +50,7 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. cp -a %{SOURCE1} . %pytest -v tests.py -%files -n %{py3_prefix}-pyrfc3339 -f %{pyproject_files} +%files -n python3-pyrfc3339 -f %{pyproject_files} %doc README.rst %changelog From 4c494443b73fdec21ccb4bf38a35395aaf41b2f9 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Fri, 8 Apr 2022 22:47:21 +0200 Subject: [PATCH 30/46] use a proper patch file for pytest support instead of changing the source file directly Sources are supposed to be unmodified upstream versions. --- pyrfc3339-use-pytest-in-tests.patch | 195 ++++++++++++++++++++++++++++ python-pyrfc3339.spec | 7 +- tests.py | 85 ++++++------ 3 files changed, 238 insertions(+), 49 deletions(-) create mode 100644 pyrfc3339-use-pytest-in-tests.patch diff --git a/pyrfc3339-use-pytest-in-tests.patch b/pyrfc3339-use-pytest-in-tests.patch new file mode 100644 index 0000000..c216f53 --- /dev/null +++ b/pyrfc3339-use-pytest-in-tests.patch @@ -0,0 +1,195 @@ +commit a863d1a3c90944b90685680af4dad5d8c7dbc0da +Author: Matthew Davis +Date: Fri Jan 28 16:42:42 2022 -0500 + + Converted tests from python-nose to pytest + +diff --git a/tests.py b/tests.py +index 831daab..d4c7622 100644 +--- a/tests.py ++++ b/tests.py +@@ -8,12 +8,11 @@ from copy import deepcopy + + from pyrfc3339 import generate, parse + from pyrfc3339.utils import timezone ++import unittest ++import pytest + import pytz + +-from nose.tools import eq_, raises +- +- +-class TestCore(): ++class TestCore(unittest.TestCase): + ''' + This test suite contains tests to address cases not tested in the doctests, + as well as additional tests for end-to-end verification. +@@ -24,8 +23,11 @@ class TestCore(): + Test rounding of timezone values to the nearest second. + + ''' +- eq_(timezone(5429), '+01:30') +- eq_(timezone(5431), '+01:31') ++ if not timezone(5429) == '+01:30': ++ raise AssertionError("%r != %r" % (timezone(5429), '+01:30')) ++ ++ if not timezone(5431) == '+01:31': ++ raise AssertionError("%r != %r" % (timezone(5431), '+01:31')) + + def test_zero_offset(self): + ''' +@@ -34,11 +36,13 @@ class TestCore(): + ''' + timestamp = '2009-01-01T10:02:03+00:00' + dt = parse(timestamp) +- eq_(dt.tzinfo, pytz.utc) ++ if not dt.tzinfo == pytz.utc: ++ raise AssertionError("%r != %r" % (dt.tzinfo, pytz.utc)) + + timestamp = '2009-01-01T10:02:03-00:00' + dt = parse(timestamp) +- eq_(dt.tzinfo, pytz.utc) ++ if not dt.tzinfo == pytz.utc: ++ raise AssertionError("%r != %r" % (dt.tzinfo, pytz.utc)) + + def test_deepcopy(self): + ''' +@@ -56,7 +60,8 @@ class TestCore(): + ''' + timestamp = '2009-01-01T10:02:03.25Z' + dt = parse(timestamp) +- eq_(dt.microsecond, 250000) ++ if not dt.microsecond == 250000: ++ raise AssertionError("%r != %r" % (dt.microsecond, 250000)) + + def test_generate_microseconds(self): + ''' +@@ -65,7 +70,8 @@ class TestCore(): + ''' + dt = datetime(2009, 1, 1, 10, 2, 3, 500000, pytz.utc) + timestamp = generate(dt, microseconds=True) +- eq_(timestamp, '2009-01-01T10:02:03.500000Z') ++ if not timestamp == '2009-01-01T10:02:03.500000Z': ++ raise AssertionError("%r != %r" % (timestamp, '2009-01-01T10:02:03.500000Z')) + + def test_mixed_case(self): + ''' +@@ -76,7 +82,8 @@ class TestCore(): + dt1 = parse('2009-01-01t10:01:02z') + dt2 = datetime(2009, 1, 1, 10, 1, 2, tzinfo=pytz.utc) + +- eq_(dt1, dt2) ++ if not dt1 == dt2: ++ raise AssertionError("%r != %r" % (dt1, dt2)) + + def test_parse_naive_utc(self): + ''' +@@ -84,15 +91,17 @@ class TestCore(): + + ''' + dt1 = parse('2009-01-01T10:01:02Z', produce_naive=True) +- eq_(dt1.tzinfo, None) ++ if not dt1.tzinfo == None: ++ raise AssertionError("%r != %r" % (dt1.tzinfo, None)) + +- @raises(ValueError) + def test_parse_naive_local(self): + ''' + Test that parsing a local timestamp to a naive datetime fails. + + ''' +- parse('2009-01-01T10:01:02-04:00', produce_naive=True) ++ with self.assertRaises(ValueError) as context: ++ parse('2009-01-01T10:01:02-04:00', produce_naive=True) ++ + + def test_generate_utc_parse_utc(self): + ''' +@@ -103,7 +112,8 @@ class TestCore(): + dt1 = dt1.replace(tzinfo=pytz.utc) + + dt2 = parse(generate(dt1, microseconds=True)) +- eq_(dt1, dt2) ++ if not dt1 == dt2: ++ raise AssertionError("%r != %r" % (dt1, dt2)) + + def test_generate_local_parse_local(self): + ''' +@@ -113,7 +123,8 @@ class TestCore(): + eastern = pytz.timezone('US/Eastern') + dt1 = eastern.localize(datetime.utcnow()) + dt2 = parse(generate(dt1, utc=False, microseconds=True), utc=False) +- eq_(dt1, dt2) ++ if not dt1 == dt2: ++ raise AssertionError("%r != %r" % (dt1, dt2)) + + def test_generate_local_parse_utc(self): + ''' +@@ -123,10 +134,12 @@ class TestCore(): + eastern = pytz.timezone('US/Eastern') + dt1 = eastern.localize(datetime.utcnow()) + dt2 = parse(generate(dt1, utc=False, microseconds=True)) +- eq_(dt1, dt2) ++ if not dt1 == dt2: ++ raise AssertionError("%r != %r" % (dt1, dt2)) + + +-class TestExhaustiveRoundtrip(): ++@pytest.mark.parametrize('tz_name', pytz.all_timezones) ++class TestExhaustiveRoundtrip: + ''' + This test suite exhaustively tests parsing and generation by generating + a local RFC 3339 timestamp for every timezone supported by pytz, +@@ -135,36 +148,32 @@ class TestExhaustiveRoundtrip(): + + slow = True + +- def test_local_roundtrip(self): +- for tz_name in pytz.all_timezones: +- yield self.local_roundtrip, tz_name +- +- def local_roundtrip(self, tz_name): ++ def test_local_roundtrip(self, tz_name): + ''' + Generates a local datetime using the given timezone, + produces a local timestamp from the datetime, parses the timestamp + to a local datetime, and verifies that the two datetimes are equal. + + ''' +- tzinfo = pytz.timezone(tz_name) +- dt1 = tzinfo.localize(datetime.utcnow()) +- timestamp = generate(dt1, utc=False, microseconds=True) +- dt2 = parse(timestamp, utc=False) +- eq_(dt1, dt2) +- +- def test_utc_roundtrip(self): +- for tz_name in pytz.all_timezones: +- yield self.utc_roundtrip, tz_name ++ if not tz_name == 'leapseconds': ++ tzinfo = pytz.timezone(tz_name) ++ dt1 = tzinfo.localize(datetime.utcnow()) ++ timestamp = generate(dt1, utc=False, microseconds=True) ++ dt2 = parse(timestamp, utc=False) ++ if not dt1 == dt2: ++ raise AssertionError("%r != %r" % (dt1, dt2)) + +- def utc_roundtrip(self, tz_name): ++ def test_utc_roundtrip(self, tz_name): + ''' + Generates a local datetime using the given timezone, + produces a local timestamp from the datetime, parses the timestamp + to a UTC datetime, and verifies that the two datetimes are equal. + + ''' +- tzinfo = pytz.timezone(tz_name) +- dt1 = tzinfo.localize(datetime.utcnow()) +- timestamp = generate(dt1, utc=False, microseconds=True) +- dt2 = parse(timestamp) +- eq_(dt1, dt2) ++ if not tz_name == 'leapseconds': ++ tzinfo = pytz.timezone(tz_name) ++ dt1 = tzinfo.localize(datetime.utcnow()) ++ timestamp = generate(dt1, utc=False, microseconds=True) ++ dt2 = parse(timestamp) ++ if not dt1 == dt2: ++ raise AssertionError("%r != %r" % (dt1, dt2)) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 96fc6b6..0ac3faf 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -12,6 +12,8 @@ Source0: %{pypi_source} # https://raw.githubusercontent.com/kurtraschke/pyRFC3339/master/pyrfc3339/tests/tests.py # v1.1: git commit e30cc155 Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc1555adce0ecc7bd65509a2249d47e5a41b4/pyrfc3339/tests/tests.py +# basically the same as https://github.com/kurtraschke/pyRFC3339/pull/16 +Patch1: pyrfc3339-use-pytest-in-tests.patch BuildArch: noarch @@ -37,7 +39,9 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %prep -%autosetup -n %{srcname}-%{version} +%autosetup -n %{srcname}-%{version} -N +cp -a %{SOURCE1} . +%patch1 -p1 %build %pyproject_wheel @@ -47,7 +51,6 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %pyproject_save_files pyrfc3339 %check -cp -a %{SOURCE1} . %pytest -v tests.py %files -n python3-pyrfc3339 -f %{pyproject_files} diff --git a/tests.py b/tests.py index d4c7622..831daab 100644 --- a/tests.py +++ b/tests.py @@ -8,11 +8,12 @@ from copy import deepcopy from pyrfc3339 import generate, parse from pyrfc3339.utils import timezone -import unittest -import pytest import pytz -class TestCore(unittest.TestCase): +from nose.tools import eq_, raises + + +class TestCore(): ''' This test suite contains tests to address cases not tested in the doctests, as well as additional tests for end-to-end verification. @@ -23,11 +24,8 @@ class TestCore(unittest.TestCase): Test rounding of timezone values to the nearest second. ''' - if not timezone(5429) == '+01:30': - raise AssertionError("%r != %r" % (timezone(5429), '+01:30')) - - if not timezone(5431) == '+01:31': - raise AssertionError("%r != %r" % (timezone(5431), '+01:31')) + eq_(timezone(5429), '+01:30') + eq_(timezone(5431), '+01:31') def test_zero_offset(self): ''' @@ -36,13 +34,11 @@ class TestCore(unittest.TestCase): ''' timestamp = '2009-01-01T10:02:03+00:00' dt = parse(timestamp) - if not dt.tzinfo == pytz.utc: - raise AssertionError("%r != %r" % (dt.tzinfo, pytz.utc)) + eq_(dt.tzinfo, pytz.utc) timestamp = '2009-01-01T10:02:03-00:00' dt = parse(timestamp) - if not dt.tzinfo == pytz.utc: - raise AssertionError("%r != %r" % (dt.tzinfo, pytz.utc)) + eq_(dt.tzinfo, pytz.utc) def test_deepcopy(self): ''' @@ -60,8 +56,7 @@ class TestCore(unittest.TestCase): ''' timestamp = '2009-01-01T10:02:03.25Z' dt = parse(timestamp) - if not dt.microsecond == 250000: - raise AssertionError("%r != %r" % (dt.microsecond, 250000)) + eq_(dt.microsecond, 250000) def test_generate_microseconds(self): ''' @@ -70,8 +65,7 @@ class TestCore(unittest.TestCase): ''' dt = datetime(2009, 1, 1, 10, 2, 3, 500000, pytz.utc) timestamp = generate(dt, microseconds=True) - if not timestamp == '2009-01-01T10:02:03.500000Z': - raise AssertionError("%r != %r" % (timestamp, '2009-01-01T10:02:03.500000Z')) + eq_(timestamp, '2009-01-01T10:02:03.500000Z') def test_mixed_case(self): ''' @@ -82,8 +76,7 @@ class TestCore(unittest.TestCase): dt1 = parse('2009-01-01t10:01:02z') dt2 = datetime(2009, 1, 1, 10, 1, 2, tzinfo=pytz.utc) - if not dt1 == dt2: - raise AssertionError("%r != %r" % (dt1, dt2)) + eq_(dt1, dt2) def test_parse_naive_utc(self): ''' @@ -91,17 +84,15 @@ class TestCore(unittest.TestCase): ''' dt1 = parse('2009-01-01T10:01:02Z', produce_naive=True) - if not dt1.tzinfo == None: - raise AssertionError("%r != %r" % (dt1.tzinfo, None)) + eq_(dt1.tzinfo, None) + @raises(ValueError) def test_parse_naive_local(self): ''' Test that parsing a local timestamp to a naive datetime fails. ''' - with self.assertRaises(ValueError) as context: - parse('2009-01-01T10:01:02-04:00', produce_naive=True) - + parse('2009-01-01T10:01:02-04:00', produce_naive=True) def test_generate_utc_parse_utc(self): ''' @@ -112,8 +103,7 @@ class TestCore(unittest.TestCase): dt1 = dt1.replace(tzinfo=pytz.utc) dt2 = parse(generate(dt1, microseconds=True)) - if not dt1 == dt2: - raise AssertionError("%r != %r" % (dt1, dt2)) + eq_(dt1, dt2) def test_generate_local_parse_local(self): ''' @@ -123,8 +113,7 @@ class TestCore(unittest.TestCase): eastern = pytz.timezone('US/Eastern') dt1 = eastern.localize(datetime.utcnow()) dt2 = parse(generate(dt1, utc=False, microseconds=True), utc=False) - if not dt1 == dt2: - raise AssertionError("%r != %r" % (dt1, dt2)) + eq_(dt1, dt2) def test_generate_local_parse_utc(self): ''' @@ -134,12 +123,10 @@ class TestCore(unittest.TestCase): eastern = pytz.timezone('US/Eastern') dt1 = eastern.localize(datetime.utcnow()) dt2 = parse(generate(dt1, utc=False, microseconds=True)) - if not dt1 == dt2: - raise AssertionError("%r != %r" % (dt1, dt2)) + eq_(dt1, dt2) -@pytest.mark.parametrize('tz_name', pytz.all_timezones) -class TestExhaustiveRoundtrip: +class TestExhaustiveRoundtrip(): ''' This test suite exhaustively tests parsing and generation by generating a local RFC 3339 timestamp for every timezone supported by pytz, @@ -148,32 +135,36 @@ class TestExhaustiveRoundtrip: slow = True - def test_local_roundtrip(self, tz_name): + def test_local_roundtrip(self): + for tz_name in pytz.all_timezones: + yield self.local_roundtrip, tz_name + + def local_roundtrip(self, tz_name): ''' Generates a local datetime using the given timezone, produces a local timestamp from the datetime, parses the timestamp to a local datetime, and verifies that the two datetimes are equal. ''' - if not tz_name == 'leapseconds': - tzinfo = pytz.timezone(tz_name) - dt1 = tzinfo.localize(datetime.utcnow()) - timestamp = generate(dt1, utc=False, microseconds=True) - dt2 = parse(timestamp, utc=False) - if not dt1 == dt2: - raise AssertionError("%r != %r" % (dt1, dt2)) + tzinfo = pytz.timezone(tz_name) + dt1 = tzinfo.localize(datetime.utcnow()) + timestamp = generate(dt1, utc=False, microseconds=True) + dt2 = parse(timestamp, utc=False) + eq_(dt1, dt2) - def test_utc_roundtrip(self, tz_name): + def test_utc_roundtrip(self): + for tz_name in pytz.all_timezones: + yield self.utc_roundtrip, tz_name + + def utc_roundtrip(self, tz_name): ''' Generates a local datetime using the given timezone, produces a local timestamp from the datetime, parses the timestamp to a UTC datetime, and verifies that the two datetimes are equal. ''' - if not tz_name == 'leapseconds': - tzinfo = pytz.timezone(tz_name) - dt1 = tzinfo.localize(datetime.utcnow()) - timestamp = generate(dt1, utc=False, microseconds=True) - dt2 = parse(timestamp) - if not dt1 == dt2: - raise AssertionError("%r != %r" % (dt1, dt2)) + tzinfo = pytz.timezone(tz_name) + dt1 = tzinfo.localize(datetime.utcnow()) + timestamp = generate(dt1, utc=False, microseconds=True) + dt2 = parse(timestamp) + eq_(dt1, dt2) From f4f701f1bc9b1468b8ddf84ac8a7682606566aea Mon Sep 17 00:00:00 2001 From: Python Maint Date: Mon, 13 Jun 2022 17:37:07 +0200 Subject: [PATCH 31/46] Rebuilt for Python 3.11 --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 0ac3faf..70a9ef1 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Mon Jun 13 2022 Python Maint - 1.1-12 +- Rebuilt for Python 3.11 + * Thu Apr 07 2022 Matthew Davis - 1.1-11 - Converted tests from python-nose to pytest - Removed Python 2 support From d4b14eda3989e9ad89c584bf26b90a21196adbad Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 22 Jul 2022 21:28:16 +0000 Subject: [PATCH 32/46] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 70a9ef1..2eab2e2 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Jul 22 2022 Fedora Release Engineering - 1.1-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Mon Jun 13 2022 Python Maint - 1.1-12 - Rebuilt for Python 3.11 From c6682ba44c56e49e2a2deae5daa5e4fa7810b1e3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 20 Jan 2023 16:20:17 +0000 Subject: [PATCH 33/46] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 2eab2e2..d630d52 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Jan 20 2023 Fedora Release Engineering - 1.1-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Fri Jul 22 2022 Fedora Release Engineering - 1.1-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 2e5b8533b4418a4a14397293c8fd9b879d1185a7 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 13 Jun 2023 23:20:06 +0200 Subject: [PATCH 34/46] Rebuilt for Python 3.12 --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index d630d52..cb76300 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Tue Jun 13 2023 Python Maint - 1.1-15 +- Rebuilt for Python 3.12 + * Fri Jan 20 2023 Fedora Release Engineering - 1.1-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 4797bfc268f6ac08b1288f603d668498180b4334 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 21 Jul 2023 12:59:14 +0000 Subject: [PATCH 35/46] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index cb76300..d2786f3 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 15%{?dist} +Release: 16%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Jul 21 2023 Fedora Release Engineering - 1.1-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue Jun 13 2023 Python Maint - 1.1-15 - Rebuilt for Python 3.12 From 320200860f61c9a2dff4f2c32edccaaf85c3035a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 22 Jan 2024 05:52:52 +0000 Subject: [PATCH 36/46] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index d2786f3..a99d28a 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 16%{?dist} +Release: 17%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Mon Jan 22 2024 Fedora Release Engineering - 1.1-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Jul 21 2023 Fedora Release Engineering - 1.1-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 47395d06466c867065fc9e7c77372cb3ecb60ba3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 26 Jan 2024 09:08:45 +0000 Subject: [PATCH 37/46] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index a99d28a..033c991 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 17%{?dist} +Release: 18%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Jan 26 2024 Fedora Release Engineering - 1.1-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Mon Jan 22 2024 Fedora Release Engineering - 1.1-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 69bbc22c0f05bb9424d0e501a58f7236ed392c7a Mon Sep 17 00:00:00 2001 From: Software Management Team Date: Thu, 30 May 2024 12:46:49 +0200 Subject: [PATCH 38/46] Eliminate use of obsolete %patchN syntax (#2283636) --- python-pyrfc3339.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 033c991..f463a91 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -41,7 +41,7 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %prep %autosetup -n %{srcname}-%{version} -N cp -a %{SOURCE1} . -%patch1 -p1 +%patch -P1 -p1 %build %pyproject_wheel From c09f8a169f63f3ab5faedd6759a71e98c01d9faa Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 7 Jun 2024 11:12:09 +0200 Subject: [PATCH 39/46] Rebuilt for Python 3.13 --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index f463a91..81bd694 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 18%{?dist} +Release: 19%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Jun 07 2024 Python Maint - 1.1-19 +- Rebuilt for Python 3.13 + * Fri Jan 26 2024 Fedora Release Engineering - 1.1-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 0f6e069dfd1db2ebbc3ea2ace525e28f2a990bc1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jul 2024 14:47:02 +0000 Subject: [PATCH 40/46] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 81bd694..103cbe3 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 1.1 -Release: 19%{?dist} +Release: 20%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -57,6 +57,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Jul 19 2024 Fedora Release Engineering - 1.1-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Fri Jun 07 2024 Python Maint - 1.1-19 - Rebuilt for Python 3.13 From 628cfdfd49df79610981ed5d10bde8939d012d53 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Fri, 3 Jan 2025 21:54:33 +0100 Subject: [PATCH 41/46] update to 2.0.1 --- .gitignore | 1 + python-pyrfc3339.spec | 20 ++--- sources | 2 +- test_all.py | 155 ++++++++++++++++++++++++++++++++++++++ tests.py | 170 ------------------------------------------ 5 files changed, 167 insertions(+), 181 deletions(-) create mode 100644 test_all.py delete mode 100644 tests.py diff --git a/.gitignore b/.gitignore index b0426c4..9d6052a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /pyRFC3339-1.0.tar.gz /pyRFC3339-1.1.tar.gz +/pyrfc3339-2.0.1.tar.gz diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 103cbe3..02bc08e 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -1,19 +1,17 @@ -%global srcname pyRFC3339 +%global srcname pyrfc3339 Name: python-pyrfc3339 -Version: 1.1 -Release: 20%{?dist} +Version: 2.0.1 +Release: 1%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT URL: https://pypi.python.org/pypi/pyRFC3339 Source0: %{pypi_source} # release tarballs do not contain unit tests (pyrfc3339/tests/tests.py) -# https://raw.githubusercontent.com/kurtraschke/pyRFC3339/master/pyrfc3339/tests/tests.py -# v1.1: git commit e30cc155 -Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/e30cc1555adce0ecc7bd65509a2249d47e5a41b4/pyrfc3339/tests/tests.py -# basically the same as https://github.com/kurtraschke/pyRFC3339/pull/16 -Patch1: pyrfc3339-use-pytest-in-tests.patch +# https://github.com/kurtraschke/pyRFC3339/blob/master/pyrfc3339/tests/test_all.py +# v2.0.1: git commit 53c2d1587d3a +Source1: https://raw.githubusercontent.com/kurtraschke/pyRFC3339/53c2d1587d3aac1734ddd4d4006a815df2d80f36/pyrfc3339/tests/test_all.py BuildArch: noarch @@ -41,7 +39,6 @@ RFC 3339-compliant timestamps using Python datetime.datetime objects. %prep %autosetup -n %{srcname}-%{version} -N cp -a %{SOURCE1} . -%patch -P1 -p1 %build %pyproject_wheel @@ -51,12 +48,15 @@ cp -a %{SOURCE1} . %pyproject_save_files pyrfc3339 %check -%pytest -v tests.py +%pytest -v test_all.py %files -n python3-pyrfc3339 -f %{pyproject_files} %doc README.rst %changelog +* Fri Jan 03 2025 Felix Schwarz - 2.0.1-1 +- update to 2.0.1 + * Fri Jul 19 2024 Fedora Release Engineering - 1.1-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/sources b/sources index 8423dc9..bb55905 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pyRFC3339-1.1.tar.gz) = 958b7761fab590aa42bb57a955c5d834441f717796a452b60df21663099dcf2fc046afe60f8157fd0f1edfd95c5e9c9c5349ab10ca4078d210fc63d848496a2f +SHA512 (pyrfc3339-2.0.1.tar.gz) = b1c6768842a8fc8917280264e4fa3e2e1223399184bd7639fbb12d3bd4755ea2cadfb291efe2bf1f3b7e89e50fcb1f89a46a9e81a94cca3a5ca0aa8c0b698c69 diff --git a/test_all.py b/test_all.py new file mode 100644 index 0000000..ed47f20 --- /dev/null +++ b/test_all.py @@ -0,0 +1,155 @@ +""" +Test suite for pyRFC3339. + +""" + +import unittest +import zoneinfo +from datetime import datetime, timezone +from zoneinfo import ZoneInfo + +from pyrfc3339 import generate, parse + + +class TestCore(unittest.TestCase): + """ + This test case contains tests to address cases not tested in the doctests, + as well as additional tests for end-to-end verification. + + """ + + def test_zero_offset(self) -> None: + """ + Both +00:00 and -00:00 are equivalent to the offset 'Z' (UTC). + + """ + timestamp = "2009-01-01T10:02:03+00:00" + dt = parse(timestamp) + self.assertEqual(dt.tzinfo, timezone.utc) + + timestamp = "2009-01-01T10:02:03-00:00" + dt = parse(timestamp) + self.assertEqual(dt.tzinfo, timezone.utc) + + def test_parse_microseconds(self) -> None: + """ + Test parsing timestamps with microseconds. + + """ + timestamp = "2009-01-01T10:02:03.25Z" + dt = parse(timestamp) + self.assertEqual(dt.microsecond, 250000) + + def test_generate_microseconds(self) -> None: + """ + Test generating timestamps with microseconds. + + """ + dt = datetime(2009, 1, 1, 10, 2, 3, 500000, tzinfo=timezone.utc) + timestamp = generate(dt, microseconds=True) + self.assertEqual(timestamp, "2009-01-01T10:02:03.500000Z") + + def test_mixed_case(self) -> None: + """ + Timestamps may use either 'T' or 't' and either 'Z' or 'z' + according to :RFC:`3339`. + + """ + dt1 = parse("2009-01-01t10:01:02z") + dt2 = datetime(2009, 1, 1, 10, 1, 2, tzinfo=timezone.utc) + + self.assertEqual(dt1, dt2) + + def test_parse_naive_utc(self) -> None: + """ + Test parsing a UTC timestamp to a naive datetime. + + """ + dt1 = parse("2009-01-01T10:01:02Z", produce_naive=True) + self.assertEqual(dt1.tzinfo, None) + + def test_parse_naive_local(self) -> None: + """ + Test that parsing a local timestamp to a naive datetime fails. + + """ + with self.assertRaises(ValueError): + parse("2009-01-01T10:01:02-04:00", produce_naive=True) + + def test_generate_utc_parse_utc(self) -> None: + """ + Generate a UTC timestamp and parse it into a UTC datetime. + + """ + dt1 = datetime.now(timezone.utc) + + dt2 = parse(generate(dt1, microseconds=True)) + self.assertEqual(dt1, dt2) + + def test_generate_local_parse_local(self) -> None: + """ + Generate a local timestamp and parse it into a local datetime. + + """ + eastern = ZoneInfo("US/Eastern") + dt1 = datetime.now(eastern) + dt2 = parse(generate(dt1, utc=False, microseconds=True), utc=False) + self.assertEqual(dt1, dt2) + + def test_generate_local_parse_utc(self) -> None: + """ + Generate a local timestamp and parse it into a UTC datetime. + + """ + eastern = ZoneInfo("US/Eastern") + dt1 = datetime.now(eastern) + dt2 = parse(generate(dt1, utc=False, microseconds=True)) + self.assertEqual(dt1, dt2) + + @unittest.skip("fails due to python/cpython#120713") + def test_three_digit_year(self) -> None: + dt = datetime(999, 1, 1, 0, 0, 0, tzinfo=timezone.utc) + self.assertEqual(generate(dt), "0999-01-01T00:00:00Z") + + +class TestExhaustiveRoundtrip(unittest.TestCase): + """ + This test case exhaustively tests parsing and generation by generating + a local RFC 3339 timestamp for every timezone supported by `zoneinfo`, + parsing that timestamp into a local datetime and a UTC datetime + and asserting that those represent the same instant. + + """ + + def setUp(self) -> None: + self.available_timezones = zoneinfo.available_timezones() + + def test_local_roundtrip(self) -> None: + """ + Generates a local datetime using the given timezone, + produces a local timestamp from the datetime, parses the timestamp + to a local datetime, and verifies that the two datetimes are equal. + + """ + for tz_name in self.available_timezones: + with self.subTest(tz=tz_name): + tzinfo = ZoneInfo(tz_name) + dt1 = datetime.now(tzinfo) + timestamp = generate(dt1, utc=False, microseconds=True) + dt2 = parse(timestamp, utc=False) + self.assertEqual(dt1, dt2) + + def test_utc_roundtrip(self) -> None: + """ + Generates a local datetime using the given timezone, + produces a local timestamp from the datetime, parses the timestamp + to a UTC datetime, and verifies that the two datetimes are equal. + + """ + for tz_name in self.available_timezones: + with self.subTest(tz=tz_name): + tzinfo = ZoneInfo(tz_name) + dt1 = datetime.now(tzinfo) + timestamp = generate(dt1, utc=False, microseconds=True) + dt2 = parse(timestamp) + self.assertEqual(dt1, dt2) diff --git a/tests.py b/tests.py deleted file mode 100644 index 831daab..0000000 --- a/tests.py +++ /dev/null @@ -1,170 +0,0 @@ -''' -Test suite for pyRFC3339. - -''' - -from datetime import datetime -from copy import deepcopy - -from pyrfc3339 import generate, parse -from pyrfc3339.utils import timezone -import pytz - -from nose.tools import eq_, raises - - -class TestCore(): - ''' - This test suite contains tests to address cases not tested in the doctests, - as well as additional tests for end-to-end verification. - - ''' - def test_timezone_rounding(self): - ''' - Test rounding of timezone values to the nearest second. - - ''' - eq_(timezone(5429), '+01:30') - eq_(timezone(5431), '+01:31') - - def test_zero_offset(self): - ''' - Both +00:00 and -00:00 are equivalent to the offset 'Z' (UTC). - - ''' - timestamp = '2009-01-01T10:02:03+00:00' - dt = parse(timestamp) - eq_(dt.tzinfo, pytz.utc) - - timestamp = '2009-01-01T10:02:03-00:00' - dt = parse(timestamp) - eq_(dt.tzinfo, pytz.utc) - - def test_deepcopy(self): - ''' - Tests that deepcopy works and doesn't crash - - ''' - timestamp = '2009-01-01T10:02:03+02:00' - dt = parse(timestamp) - deepcopy(dt) - - def test_parse_microseconds(self): - ''' - Test parsing timestamps with microseconds. - - ''' - timestamp = '2009-01-01T10:02:03.25Z' - dt = parse(timestamp) - eq_(dt.microsecond, 250000) - - def test_generate_microseconds(self): - ''' - Test generating timestamps with microseconds. - - ''' - dt = datetime(2009, 1, 1, 10, 2, 3, 500000, pytz.utc) - timestamp = generate(dt, microseconds=True) - eq_(timestamp, '2009-01-01T10:02:03.500000Z') - - def test_mixed_case(self): - ''' - Timestamps may use either 'T' or 't' and either 'Z' or 'z' - according to :RFC:`3339`. - - ''' - dt1 = parse('2009-01-01t10:01:02z') - dt2 = datetime(2009, 1, 1, 10, 1, 2, tzinfo=pytz.utc) - - eq_(dt1, dt2) - - def test_parse_naive_utc(self): - ''' - Test parsing a UTC timestamp to a naive datetime. - - ''' - dt1 = parse('2009-01-01T10:01:02Z', produce_naive=True) - eq_(dt1.tzinfo, None) - - @raises(ValueError) - def test_parse_naive_local(self): - ''' - Test that parsing a local timestamp to a naive datetime fails. - - ''' - parse('2009-01-01T10:01:02-04:00', produce_naive=True) - - def test_generate_utc_parse_utc(self): - ''' - Generate a UTC timestamp and parse it into a UTC datetime. - - ''' - dt1 = datetime.utcnow() - dt1 = dt1.replace(tzinfo=pytz.utc) - - dt2 = parse(generate(dt1, microseconds=True)) - eq_(dt1, dt2) - - def test_generate_local_parse_local(self): - ''' - Generate a local timestamp and parse it into a local datetime. - - ''' - eastern = pytz.timezone('US/Eastern') - dt1 = eastern.localize(datetime.utcnow()) - dt2 = parse(generate(dt1, utc=False, microseconds=True), utc=False) - eq_(dt1, dt2) - - def test_generate_local_parse_utc(self): - ''' - Generate a local timestamp and parse it into a UTC datetime. - - ''' - eastern = pytz.timezone('US/Eastern') - dt1 = eastern.localize(datetime.utcnow()) - dt2 = parse(generate(dt1, utc=False, microseconds=True)) - eq_(dt1, dt2) - - -class TestExhaustiveRoundtrip(): - ''' - This test suite exhaustively tests parsing and generation by generating - a local RFC 3339 timestamp for every timezone supported by pytz, - and parsing that timestamp into a local datetime and a UTC datetime. - ''' - - slow = True - - def test_local_roundtrip(self): - for tz_name in pytz.all_timezones: - yield self.local_roundtrip, tz_name - - def local_roundtrip(self, tz_name): - ''' - Generates a local datetime using the given timezone, - produces a local timestamp from the datetime, parses the timestamp - to a local datetime, and verifies that the two datetimes are equal. - - ''' - tzinfo = pytz.timezone(tz_name) - dt1 = tzinfo.localize(datetime.utcnow()) - timestamp = generate(dt1, utc=False, microseconds=True) - dt2 = parse(timestamp, utc=False) - eq_(dt1, dt2) - - def test_utc_roundtrip(self): - for tz_name in pytz.all_timezones: - yield self.utc_roundtrip, tz_name - - def utc_roundtrip(self, tz_name): - ''' - Generates a local datetime using the given timezone, - produces a local timestamp from the datetime, parses the timestamp - to a UTC datetime, and verifies that the two datetimes are equal. - - ''' - tzinfo = pytz.timezone(tz_name) - dt1 = tzinfo.localize(datetime.utcnow()) - timestamp = generate(dt1, utc=False, microseconds=True) - dt2 = parse(timestamp) - eq_(dt1, dt2) From 1a4206f8728aba0f6fe80f4cb76278b8d22bf9f6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 18 Jan 2025 18:06:33 +0000 Subject: [PATCH 42/46] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 02bc08e..197223a 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 2.0.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -54,6 +54,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Sat Jan 18 2025 Fedora Release Engineering - 2.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Fri Jan 03 2025 Felix Schwarz - 2.0.1-1 - update to 2.0.1 From 5b441f661d5f91bce1734669665e1516188236fa Mon Sep 17 00:00:00 2001 From: Python Maint Date: Mon, 2 Jun 2025 22:51:57 +0200 Subject: [PATCH 43/46] Rebuilt for Python 3.14 --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 197223a..d367991 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 2.0.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -54,6 +54,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Mon Jun 02 2025 Python Maint - 2.0.1-3 +- Rebuilt for Python 3.14 + * Sat Jan 18 2025 Fedora Release Engineering - 2.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From b7065f788d1ab61ae0b69b75eae615b2c85c91be Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 09:47:55 +0000 Subject: [PATCH 44/46] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index d367991..225a6e7 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 2.0.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -54,6 +54,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 2.0.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Mon Jun 02 2025 Python Maint - 2.0.1-3 - Rebuilt for Python 3.14 From 6e7f79fbe3c34ef08d9a9b428ffc11dd258a633e Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 15 Aug 2025 14:35:01 +0200 Subject: [PATCH 45/46] Rebuilt for Python 3.14.0rc2 bytecode --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 225a6e7..8fc8b3a 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 2.0.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -54,6 +54,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Aug 15 2025 Python Maint - 2.0.1-5 +- Rebuilt for Python 3.14.0rc2 bytecode + * Fri Jul 25 2025 Fedora Release Engineering - 2.0.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From b260403f1d4a9ace14e234abda36b21e5eed80b4 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 19 Sep 2025 14:09:54 +0200 Subject: [PATCH 46/46] Rebuilt for Python 3.14.0rc3 bytecode --- python-pyrfc3339.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pyrfc3339.spec b/python-pyrfc3339.spec index 8fc8b3a..8727d46 100644 --- a/python-pyrfc3339.spec +++ b/python-pyrfc3339.spec @@ -2,7 +2,7 @@ Name: python-pyrfc3339 Version: 2.0.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Generate and parse RFC 3339 timestamps License: MIT @@ -54,6 +54,9 @@ cp -a %{SOURCE1} . %doc README.rst %changelog +* Fri Sep 19 2025 Python Maint - 2.0.1-6 +- Rebuilt for Python 3.14.0rc3 bytecode + * Fri Aug 15 2025 Python Maint - 2.0.1-5 - Rebuilt for Python 3.14.0rc2 bytecode