Page MenuHomePhabricator

DeprecationWarning: datetime.datetime.utcnow() is deprecated
Closed, ResolvedPublic

Description

Spotted these spicerack deprecation warnings when running the wmcs-cookbooks test suite, although it seems like there are more places than just these that need replacing utcnow:

/home/taavi/src/wmf-automation/wmcs-cookbooks/.tox/py313-tests/lib/python3.13/site-packages/spicerack/_menu.py:231: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  start_time = datetime.utcnow()

/home/taavi/src/wmf-automation/wmcs-cookbooks/.tox/py313-tests/lib/python3.13/site-packages/spicerack/_menu.py:242: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  (datetime.utcnow() - start_time).total_seconds(),

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
elukey added a project: User-Elukey.

Change #1194213 had a related patch set uploaded (by Elukey; author: Elukey):

[operations/software/spicerack@master] Remove a deprecation warning for datetime in _menu.py

https://gerrit.wikimedia.org/r/1194213

Change #1196139 had a related patch set uploaded (by Majavah; author: Majavah):

[operations/software/spicerack@master] remote: Support timezone-aware objects

https://gerrit.wikimedia.org/r/1196139

Change #1194213 abandoned by Elukey:

[operations/software/spicerack@master] Remove a deprecation warning for datetime in _menu.py

https://gerrit.wikimedia.org/r/1194213

Change #1196139 merged by jenkins-bot:

[operations/software/spicerack@master] remote: Support timezone-aware objects

https://gerrit.wikimedia.org/r/1196139

elukey claimed this task.
elukey subscribed.

The fix will go out in the next Spicerack release, closing!