From 3fa71cdf0eede3d290ba9321af873f50882ae468 Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Sat, 19 Oct 2024 17:56:09 +0200 Subject: [PATCH] Don't use `datetime.utcnow()`. (#440) * Don't use `datetime.utcnow()` (deprecated). * Use timezone.utc for compatibility with Py<3.11 --- caldav/objects.py | 2 +- tests/test_caldav.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/caldav/objects.py b/caldav/objects.py index 5cf7314..0e78b0b 100644 --- a/caldav/objects.py +++ b/caldav/objects.py @@ -2999,7 +2999,7 @@ def complete( * safe - see doc for _complete_recurring_safe for details """ if not completion_timestamp: - completion_timestamp = datetime.utcnow().astimezone(timezone.utc) + completion_timestamp = datetime.now(timezone.utc) if "RRULE" in self.icalendar_component and handle_rrule: return getattr(self, "_complete_recurring_%s" % rrule_mode)( diff --git a/tests/test_caldav.py b/tests/test_caldav.py index d7e5e0e..1fd855d 100644 --- a/tests/test_caldav.py +++ b/tests/test_caldav.py @@ -2288,7 +2288,7 @@ def testCreateOverwriteDeleteEvent(self): if not self.check_compatibility_flag( "no_todo" ) and not self.check_compatibility_flag("no_todo_on_standard_calendar"): - t1.delete + t1.delete() if self.check_compatibility_flag("non_existing_raises_other"): expected_error = error.DAVError