test: Use timezone aware datetime#7918
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7918 +/- ##
==========================================
+ Coverage 88.78% 88.82% +0.04%
==========================================
Files 296 304 +8
Lines 41320 41495 +175
==========================================
+ Hits 36687 36860 +173
- Misses 4633 4635 +2 ☔ View full report in Codecov by Sentry. |
jennifer-richards
left a comment
There was a problem hiding this comment.
Modulo date vs datetime, this should help.
There'll still be a very brief window around midnight UTC when this could fail. I wonder if we should write a test helper named something like date_or_wait(dt: TimeDelta) that will sleep if it's called within dt of a date change, then return the next day. I think this could protect us from random failures.
We can use something like Freezgun to set a specific date too. The test I introduce follows the patterns of the existing test suite. The test for date is trivial & and go without it? |
Seems worth investigating, but what you've got here is fine. |
This might prevent errors like https://github.com/ietf-tools/datatracker/actions/runs/10786037653/job/29912248540#step:6:1902