diff --git a/0001-Fix-decorate_class-for-Python-3.10-where-staticmethod-is.patch b/0001-Fix-decorate_class-for-Python-3.10-where-staticmethod-is.patch new file mode 100644 index 0000000000000000000000000000000000000000..53f67f32e344252cee105349b8ec4b5f3a4dd12d --- /dev/null +++ b/0001-Fix-decorate_class-for-Python-3.10-where-staticmethod-is.patch @@ -0,0 +1,26 @@ +From e63874ce75a74a1159390914045fe8e7955b24c4 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Singaravelan +Date: Fri, 7 May 2021 15:51:33 +0000 +Subject: [PATCH] Fix decorate_class for Python 3.10 where staticmethod is + callable. + +--- + freezegun/api.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/freezegun/api.py b/freezegun/api.py +index cab9ebe..55a80c7 100644 +--- a/freezegun/api.py ++++ b/freezegun/api.py +@@ -598,7 +598,10 @@ def tearDownClass(cls): + continue + seen.add(attr) + +- if not callable(attr_value) or inspect.isclass(attr_value): ++ # staticmethods are callable from Python 3.10 . Hence skip them from decoration ++ if (not callable(attr_value) ++ or inspect.isclass(attr_value) ++ or isinstance(attr_value, staticmethod)): + continue + + try: diff --git a/freezegun-1.2.2.tar.gz b/freezegun-1.2.2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..17487fc8021d099f8d211e405da9ca650f04c335 Binary files /dev/null and b/freezegun-1.2.2.tar.gz differ diff --git a/python-freezegun.spec b/python-freezegun.spec new file mode 100644 index 0000000000000000000000000000000000000000..559f475fc815fc59cd3caff525c57c10c5901acf --- /dev/null +++ b/python-freezegun.spec @@ -0,0 +1,76 @@ +%define anolis_release 1 + +%global modname freezegun +%global sum Let your Python tests travel through time + +Name: python-freezegun +Version: 1.2.2 +Release: %{anolis_release}%{dist} +Summary: %{sum} +License: ASL 2.0 +URL: https://pypi.io/project/freezegun +Source0: https://pypi.io/packages/source/f/%{modname}/%{modname}-%{version}.tar.gz + +Patch1: 0001-Fix-decorate_class-for-Python-3.10-where-staticmethod-is.patch + +BuildArch: noarch + +%description +freezegun is a library that allows your python tests to travel through time by +mocking the datetime module. + +%package -n python3-freezegun +Summary: %{sum} + +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-six +BuildRequires: python3-dateutil >= 2.7 +BuildRequires: python3-pytest + +%{?python_provide:%python_provide python3-freezegun} + +Requires: python3-six +Requires: python3-dateutil >= 2.7 + +%description -n python3-freezegun +freezegun is a library that allows your python tests to travel through time by +mocking the datetime module. This is the Python 3 library. + +%package -n python3-freezegun-doc +Summary: Documentation files for python3-freezegun +Requires: python3-freezegun = %{EVR} +BuildArch: noarch + +%description -n python3-freezegun-doc +The python3-freezegun-doc package contains documentation files for python3-freezegun. + +%prep +%autosetup -p1 -n %{modname}-%{version} + +# Remove bundled egg-info in case it exists +rm -rf %{modname}.egg-info + +%build +%py3_build + +%install +%py3_install + +%check +# Ignore two tests that are broken when run on systems in certain timezones. +# Reported upstream: https://github.com/spulec/freezegun/issues/348 +pytest-3 --deselect tests/test_datetimes.py::TestUnitTestMethodDecorator::test_method_decorator_works_on_unittest_kwarg_frozen_time \ + --deselect tests/test_datetimes.py::TestUnitTestMethodDecorator::test_method_decorator_works_on_unittest_kwarg_hello + +%files -n python3-freezegun +%license LICENSE +%{python3_sitelib}/%{modname}/ +%{python3_sitelib}/%{modname}-%{version}-* + +%files -n python3-freezegun-doc +%doc README.rst + +%changelog +* Wed Mar 29 2023 yuanhui - 1.2.2-1 +- Init package from upstream