Skip to content

Conversation

@TheRealHaoLiu
Copy link
Member

@TheRealHaoLiu TheRealHaoLiu commented Dec 4, 2025

SUMMARY

Refactored code to use Python's built-in datetime.timezone and zoneinfo instead of pytz for timezone handling. This modernizes the codebase and removes the dependency on pytz, aligning with current best practices for timezone-aware datetime objects.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • API
ADDITIONAL INFORMATION


Note

Replaces pytz with Python’s built-in datetime.timezone and zoneinfo across schedules, API preview, cleanup command, and tests, and tidies related pytest warnings.

  • Timezone migration:
    • Replace pytz with stdlib datetime.timezone/zoneinfo in awx/api/views/__init__.py (schedule preview UTC conversion), awx/main/models/schedules.py (all UTC conversions), and awx/main/management/commands/cleanup_jobs.py (partition datetime parsing).
  • Schedules:
    • Use datetime.timezone.utc for UNTIL, next_run, dtstart, dtend, and end-date calculations in awx/main/models/schedules.py.
  • Tests:
    • Update to use timezone.utc and ZoneInfo; adjust mocks and datetime constructions in awx/main/tests/functional/models/test_schedule.py.
  • Config:
    • Clean up pytest.ini warnings (remove obsolete USE_TZ note).

Written by Cursor Bugbot for commit c30d65a. This will update automatically on new commits. Configure here.

Refactored code to use Python's built-in datetime.timezone and zoneinfo instead of pytz for timezone handling. This modernizes the codebase and removes the dependency on pytz, aligning with current best practices for timezone-aware datetime objects.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 4, 2025

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