diff --git a/backport-Remove-deprecated-pytest-warns-None-from-test_internals.py.patch b/backport-Remove-deprecated-pytest-warns-None-from-test_internals.py.patch new file mode 100644 index 0000000000000000000000000000000000000000..c7a078c2046dca7b19e36b2822bf597cf8283d1e --- /dev/null +++ b/backport-Remove-deprecated-pytest-warns-None-from-test_internals.py.patch @@ -0,0 +1,46 @@ +From 2bdd63158b7f981fc6d70a869680451bdfd8d848 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20Kul=C3=ADk?= +Date: Thu, 10 Feb 2022 10:28:42 +0100 +Subject: [PATCH] Remove deprecated pytest.warns(None) from test_internals.py + +--- + tests/test_internals.py | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/tests/test_internals.py b/tests/test_internals.py +index 530813147..b32e6723f 100644 +--- a/tests/test_internals.py ++++ b/tests/test_internals.py +@@ -9,6 +9,7 @@ + + import sys + import pytest ++import warnings + + from dateutil.parser._parser import _ymd + from dateutil import tz +@@ -65,18 +66,17 @@ def test_parser_parser_private_not_warns(): + from dateutil.parser._parser import _timelex, _tzparser + from dateutil.parser._parser import _parsetz + +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _tzparser() +- assert len(recorder) == 0 + +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _timelex('2014-03-03') + +- assert len(recorder) == 0 +- +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _parsetz('+05:00') +- assert len(recorder) == 0 + + + @pytest.mark.tzstr diff --git a/backport-avoid-deprecated-utcfromtimestamp.patch b/backport-avoid-deprecated-utcfromtimestamp.patch new file mode 100644 index 0000000000000000000000000000000000000000..c4ebe23dabc6731010dde25bc4a06534aceccdd3 --- /dev/null +++ b/backport-avoid-deprecated-utcfromtimestamp.patch @@ -0,0 +1,23 @@ +From f2293200747fb03d56c6c5997bfebeabe703576f Mon Sep 17 00:00:00 2001 +From: Thomas Grainger +Date: Fri, 2 Jun 2023 14:06:41 +0100 +Subject: [PATCH] avoid deprecated utcfromtimestamp + +Fixes #1284 +--- + src/dateutil/tz/tz.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/dateutil/tz/tz.py b/src/dateutil/tz/tz.py +index c67f56d46..617591446 100644 +--- a/src/dateutil/tz/tz.py ++++ b/src/dateutil/tz/tz.py +@@ -34,7 +34,7 @@ + from warnings import warn + + ZERO = datetime.timedelta(0) +-EPOCH = datetime.datetime.utcfromtimestamp(0) ++EPOCH = datetime.datetime(1970, 1, 1, 0, 0) + EPOCHORDINAL = EPOCH.toordinal() + + diff --git a/python-dateutil.spec b/python-dateutil.spec index 046bcf0f34d609f862fb9bb6522b70a2e029dc45..068fde95ed4dea146a843d272bfde7e7f1bd598b 100644 --- a/python-dateutil.spec +++ b/python-dateutil.spec @@ -3,12 +3,24 @@ Name: python-dateutil Version: 2.8.2 -Release: 3 +Release: 4 Epoch: 1 Summary: Powerful extensions to datetime -License: Apache 2.0 or BSD or Python +License: (Apache-2.0 AND BSD-3-Clause) OR BSD-3-Clause URL: https://github.com/dateutil/dateutil -Source0: https://files.pythonhosted.org/packages/source/p/python-dateutil/python-dateutil-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/p/python-dateutil/python-dateutil-%{version}.tar.gz + +# Remove deprecated pytest.warns(None) from test_internals.py +# +# Fixes: +# python-dateutil fails to build with pytest 7 +# https://github.com/dateutil/dateutil/commit/2bdd63158b7f981fc6d70a869680451bdfd8d848 +Patch6001: backport-Remove-deprecated-pytest-warns-None-from-test_internals.py.patch + +# Backport the replacement for the deprecated in Python 3.12 +# datetime.datetime.utcfromtimestamp() +# https://github.com/dateutil/dateutil/pull/1285 +Patch6002: backport-avoid-deprecated-utcfromtimestamp.patch BuildArch: noarch @@ -28,7 +40,13 @@ Requires: python3-six tzdata %package_help %prep -%autosetup -n %{name}-%{version} -p1 +%autosetup -n %{name}-%{version} -N +# the tests were moved outside of source directory upstream after 2.8.2 +# so we apply the patch with new paths from within it +pushd %{_name}/test +%patch -P6001 -p2 +popd +%patch -P6002 -p2 %build %py3_build @@ -37,47 +55,46 @@ Requires: python3-six tzdata %py3_install %check -rm setup.cfg -export LANG=en_US.UTF-8 -%{__python3} -m pytest +%{__python3} -m pytest -W ignore::pytest.PytestUnknownMarkWarning %files -n python3-%{_name} -%defattr(-,root,root) %doc README.rst %license LICENSE %{python3_sitelib}/%{_name}/ %{python3_sitelib}/*info %files help -%defattr(-,root,root) %doc NEWS PKG-INFO RELEASING %changelog -* Tue Aug 09 2022 shixuantong - 2.8.2-3 +* Mon Jan 27 2025 Funda Wang - 1:2.8.2-4 +- fix test with latest python-test + +* Tue Aug 09 2022 shixuantong - 1:2.8.2-3 - Type:bugfix - ID:NA - SUG:NA - DESC:remove gdb Buildrequires -* Wed Jan 05 2022 shixuantong - 2.8.2-2 +* Wed Jan 05 2022 shixuantong - 1:2.8.2-2 - Type:bugfix - ID:NA - SUG:NA - DESC:add python3-sortedcontainers to Buildrequires -* Sat Nov 13 2021 liudabo - 2.8.2-1 +* Sat Nov 13 2021 liudabo - 1:2.8.2-1 - Type:NA - ID:NA - SUG:NA - DESC:update version to 2.8.2 -* Tue Jan 19 2021 tianwei - 2.8.1-3 +* Tue Jan 19 2021 tianwei - 1:2.8.1-3 - Type:NA - ID:NA - SUG:NA - DESC: fix Unknown pytest.mark.no_cover fail in make check -* Fri Oct 30 2020 shixuantong - 2.8.1-2 +* Fri Oct 30 2020 shixuantong - 1:2.8.1-2 - Type:NA - ID:NA - SUG:NA