python3-freezegun: update to 1.5.1

This commit is contained in:
Tom Strausbaugh 2025-01-11 09:24:21 -05:00 committed by classabbyamp
parent 6293dedc8d
commit ab6daf1231
3 changed files with 28 additions and 33 deletions

View file

@ -1,30 +0,0 @@
From 57d024e4ce2516c55c715448296b9099db68343c Mon Sep 17 00:00:00 2001
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Date: Fri, 7 May 2021 15:51:33 +0000
Subject: [PATCH] Fix decorate_class for Python 3.10 where staticmethod is
callable.
https://github.com/spulec/freezegun/pull/397 (edited by mgorny for more readable indent)
---
freezegun/api.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/freezegun/api.py b/freezegun/api.py
index cab9ebe..eb3a931 100644
--- a/freezegun/api.py
+++ b/freezegun/api.py
@@ -598,7 +598,10 @@ class _freeze_time(object):
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:
--
2.31.1

View file

@ -0,0 +1,25 @@
https://github.com/spulec/freezegun/pull/550
--- a/tests/test_datetimes.py
+++ b/tests/test_datetimes.py
@@ -534,17 +534,17 @@
@freeze_time('2013-04-09', as_kwarg='frozen_time')
def test_method_decorator_works_on_unittest_kwarg_frozen_time(self, frozen_time: Any) -> None:
self.assertEqual(datetime.date(2013, 4, 9), datetime.date.today())
- self.assertEqual(datetime.date(2013, 4, 9), frozen_time.time_to_freeze.today())
+ assert frozen_time.time_to_freeze.today().strftime('%Y-%m-%d') == "2013-04-09"
@freeze_time('2013-04-09', as_kwarg='hello')
def test_method_decorator_works_on_unittest_kwarg_hello(self, **kwargs: Any) -> None:
self.assertEqual(datetime.date(2013, 4, 9), datetime.date.today())
- self.assertEqual(datetime.date(2013, 4, 9), kwargs.get('hello').time_to_freeze.today()) # type: ignore
+ assert kwargs.get("hello").time_to_freeze.today().strftime('%Y-%m-%d') == "2013-04-09" # type: ignore
@freeze_time(lambda: datetime.date(year=2013, month=4, day=9), as_kwarg='frozen_time')
def test_method_decorator_works_on_unittest_kwarg_frozen_time_with_func(self, frozen_time: Any) -> None:
self.assertEqual(datetime.date(2013, 4, 9), datetime.date.today())
- self.assertEqual(datetime.date(2013, 4, 9), frozen_time.time_to_freeze.today())
+ assert frozen_time.time_to_freeze.today().strftime('%Y-%m-%d') == "2013-04-09"
@freeze_time('2013-04-09')

View file

@ -1,7 +1,7 @@
# Template file for 'python3-freezegun'
pkgname=python3-freezegun
version=1.2.2
revision=4
version=1.5.1
revision=1
build_style=python3-module
hostmakedepends="python3-setuptools"
depends="python3-dateutil"
@ -12,7 +12,7 @@ license="Apache-2.0"
homepage="https://github.com/spulec/freezegun"
changelog="https://raw.githubusercontent.com/spulec/freezegun/master/CHANGELOG"
distfiles="${PYPI_SITE}/f/freezegun/freezegun-${version}.tar.gz"
checksum=cd22d1ba06941384410cd967d8a99d5ae2442f57dfafeff2fda5de8dc5c05446
checksum=b29dedfcda6d5e8e083ce71b2b542753ad48cfec44037b3fc79702e2980a89e9
do_check() {
# Timezone needs to be fixed due to