Description
The Elexon plotting flow and its tests currently use datetime.utcnow(), which is deprecated in Python 3.12+ and emits deprecation warnings.
We should migrate to timezone-aware UTC datetimes (e.g., datetime.now(datetime.UTC)) while preserving the existing behavior for start/end datetime calculations.
This will reduce warning noise and ensure the code remains future-compatible with newer Python versions.
Scope
elexon_plots.py
test_elexon_plot.py
Expected Behavior
- No
datetime.utcnow() deprecation warnings from these code paths.
- Datetime handling remains functionally equivalent.
Acceptance Criteria
- All
datetime.utcnow() usage replaced with timezone-aware alternatives.
- No deprecation warnings from these files.
- Existing Elexon tests continue to pass.
- Changes limited to Elexon code and tests only.
Description
The Elexon plotting flow and its tests currently use
datetime.utcnow(), which is deprecated in Python 3.12+ and emits deprecation warnings.We should migrate to timezone-aware UTC datetimes (e.g.,
datetime.now(datetime.UTC)) while preserving the existing behavior for start/end datetime calculations.This will reduce warning noise and ensure the code remains future-compatible with newer Python versions.
Scope
elexon_plots.pytest_elexon_plot.pyExpected Behavior
datetime.utcnow()deprecation warnings from these code paths.Acceptance Criteria
datetime.utcnow()usage replaced with timezone-aware alternatives.