Skip to content

Conversation

@alirafiei75
Copy link
Contributor

Description

This pull request refactors TzAwareCrontab class's is_due() method to adhere to its super class implementation (taking into account the beat_cron_starting_deadline configuration)

Changes

  • Refactored TzAwareCrontab.is_due()
  • Added unit tests for the beat_cron_starting_deadline adherence

Related Issues

#809

@codecov
Copy link

codecov bot commented May 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.17%. Comparing base (673dbc5) to head (f54e038).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #899      +/-   ##
==========================================
- Coverage   88.24%   88.17%   -0.08%     
==========================================
  Files          32       32              
  Lines        1012     1006       -6     
  Branches      105      104       -1     
==========================================
- Hits          893      887       -6     
  Misses        101      101              
  Partials       18       18              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@auvipy auvipy requested a review from Copilot May 17, 2025 08:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors the TzAwareCrontab.is_due() method to leverage the superclass implementation and better respect the beat_cron_starting_deadline configuration, while adding associated unit tests for various timing scenarios.

  • Refactored TzAwareCrontab.is_due() to call super().is_due()
  • Added several unit tests covering edge cases related to the beat_cron_starting_deadline
  • Adjusted docstring formatting in tests for clarity

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
t/unit/test_schedulers.py Added new unit tests for TzAwareCrontab behavior with deadlines
django_celery_beat/tzcrontab.py Simplified is_due() to delegate functionality to the superclass
Comments suppressed due to low confidence (1)

django_celery_beat/tzcrontab.py:38

  • [nitpick] Consider updating the is_due() docstring to indicate that the method now directly defers to the superclass implementation (which handles the beat_cron_starting_deadline logic) to avoid potential confusion.
"""Calculate when the next run will take place."""

@patch("django_celery_beat.schedulers.aware_now")
def test_server_timezone_handling_with_zoneinfo(self, mock_aware_now):
"""Test handling when server timezone is already a ZoneInfo instance."""
"""Test handling when server timezone
Copy link

Copilot AI May 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider reformatting the multi-line docstring in the test_server_timezone_handling_with_zoneinfo test for consistency and clarity.

Copilot uses AI. Check for mistakes.
@auvipy auvipy merged commit 70d381b into celery:main May 18, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants