Roundup Tracker - Issues

Issue 2551278

classification
datetime.datetime.utcnow deprecation
Type: behavior Severity: normal
Components: Web interface, Mail interface, Command-line interface Versions: 2.4.0
process
Status: fixed fixed
:
: rouilj : rouilj
Priority: : Blocker, Deprecation

Created on 2023-05-25 23:35 by rouilj, last changed 2023-07-27 05:17 by rouilj.

Messages
msg7775 Author: [hidden] (rouilj) Date: 2023-05-25 23:35
3.12 test is throwing the following warnings:

 /home/runner/work/roundup/roundup/roundup/date.py:379: DeprecationWarning: datetime.utcnow() 
is deprecated and scheduled for removal in a future version. Use timezone-aware objects to 
represent datetimes in UTC: datetime.now(datetime.UTC).

probably need a roundup/anypy/datetime_.py that exports a utcnow() function and then
and import and replace datetime.datetime.utcnow() to utcnow() in:

 date.py, rate_limit.py, test/rest_common.py

source:

https://github.com/roundup-tracker/roundup/actions/runs/5085234225/jobs/9138474935
msg7785 Author: [hidden] (rouilj) Date: 2023-06-18 21:30
See also: https://blog.ganssle.io/articles/2019/11/utcnow.html
msg7815 Author: [hidden] (rouilj) Date: 2023-07-25 20:31
changeset:   7587:8f29e4ea05ce

fixes this using the method described.
msg7819 Author: [hidden] (rouilj) Date: 2023-07-27 04:00
Checked coverage. It was taking the alternate branch that used utcnow() and not now(UTC).

changeset:   7589:6894f152d49a should fix this I think.
msg7820 Author: [hidden] (rouilj) Date: 2023-07-27 05:17
And it did fix it, but other dates in the rate_limit.py module were naive dates
and had to be converted to tz aware dates for 3.11+ otherwise the arithmetic would
fail. Also had to marshall/unmarshall to iso format when saving in the db.

changeset:   7590:5fbd3af526bd

passed ci and I verified that both code paths in datetime_.py were executed.
History
Date User Action Args
2023-07-27 05:17:01rouiljsetmessages: + msg7820
2023-07-27 04:00:31rouiljsetmessages: + msg7819
2023-07-25 20:31:24rouiljsetstatus: new -> fixed
assignee: rouilj
messages: + msg7815
resolution: fixed
type: behavior
2023-06-26 19:20:13rouiljsetversions: + 2.4.0
2023-06-18 21:30:26rouiljsetmessages: + msg7785
2023-05-25 23:35:34rouiljcreate