Skip to content

Replace deprecated datetime.datetime.utcnow() with timezone-aware UTC timestamps #2

Description

@Kaap10

Description

In Python 3.12+, datetime.datetime.utcnow() has been deprecated and triggers runtime DeprecationWarning notices during test execution.

Proposed Solution

Replace all occurrences of datetime.datetime.utcnow() in backend/app/storage/repository.py and backend/app/benchmarks/runner.py with timezone-aware UTC timestamps:

from datetime import datetime, timezone

# Use timezone-aware UTC timestamp:
datetime.now(timezone.utc)

Relevant Files

  • backend/app/storage/repository.py
  • backend/app/benchmarks/runner.py

Acceptance Criteria

  • Replace datetime.datetime.utcnow() across all backend modules.
  • Run python -m pytest and verify that all 13 tests pass with 0 deprecation warnings.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions