Skip to content

Conversation

@Nusnus
Copy link
Member

@Nusnus Nusnus commented Jul 23, 2025

Replace deprecated datetime.utcfromtimestamp() with datetime.fromtimestamp() using timezone.utc. The deprecated method was removed in Python 3.12+.

Also fix test timezone handling to create proper UTC timestamps and update assertions to expect timezone-aware datetime format.

Fixes failing tests:

  • test_on_event_task_received
  • test_on_event_non_task

Originally contributed in #9711

@Nusnus Nusnus added this to the 5.6.0 milestone Jul 23, 2025
@Nusnus Nusnus self-assigned this Jul 23, 2025
@codecov
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.62%. Comparing base (4841c99) to head (8276c3c).
⚠️ Report is 70 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9826   +/-   ##
=======================================
  Coverage   78.62%   78.62%           
=======================================
  Files         153      153           
  Lines       19199    19199           
  Branches     2547     2547           
=======================================
  Hits        15095    15095           
  Misses       3811     3811           
  Partials      293      293           
Flag Coverage Δ
unittests 78.60% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Nusnus Nusnus marked this pull request as ready for review July 23, 2025 17:26
@Nusnus Nusnus marked this pull request as draft July 23, 2025 21:50
@auvipy auvipy requested a review from Copilot July 24, 2025 08:04

This comment was marked as resolved.

@Nusnus Nusnus force-pushed the bugfix branch 2 times, most recently from 0a6dcc2 to a876a58 Compare August 1, 2025 00:26
@auvipy auvipy requested a review from Copilot August 1, 2025 05:15

This comment was marked as resolved.

Replace deprecated datetime.utcfromtimestamp() with datetime.fromtimestamp()
using timezone.utc. The deprecated method was removed in Python 3.12+.

Also fix test timezone handling to create proper UTC timestamps and
update assertions to expect timezone-aware datetime format.

Fixes failing tests:
- test_on_event_task_received
- test_on_event_non_task
@auvipy
Copy link
Member

auvipy commented Aug 3, 2025

only 8 checks are failing now. seems mainly redis only

@Nusnus Nusnus marked this pull request as ready for review August 3, 2025 20:02
@Nusnus Nusnus merged commit 46443dc into celery:main Aug 3, 2025
116 of 124 checks passed
@Nusnus Nusnus deleted the bugfix branch August 3, 2025 20:02
@Nusnus
Copy link
Member Author

Nusnus commented Aug 3, 2025

The unit tests passed on the CI but not locally:

FAILED t/unit/events/test_dumper.py::test_on_event_task_received - AssertionError: assert 'worker1 [2024-01-01 12:00:00]' in 'worker1 [2024-01-01 10:00:00] task received mytask(abc) args=(1,) kwargs={} \n'
FAILED t/unit/events/test_dumper.py::test_on_event_non_task - AssertionError: assert 'worker1 [2024-01-01 12:00:00]' in 'worker1 [2024-01-01 10:00:00] started: foo=bar\n’

Now local & CI are similar:

3.13-unit: OK (152.92=setup[1.81]+cmd[151.10] seconds)

@auvipy
Copy link
Member

auvipy commented Aug 4, 2025

wow interesting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants