Page MenuHomeSoftware Heritage

tests: fix test_replay; do only use aware datetime objects
ClosedPublic

Authored by douardda on May 11 2020, 4:23 PM.

Details

Summary

naive dates being now properly forbidden.

Diff Detail

Repository
rDSTO Storage manager
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D3137 (id=11150)

Rebasing onto 4edf9e1454...

Current branch diff-target is up to date.
Changes applied before test
commit e64944bc53c936419dfa523424b5c171c2d1425a
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon May 11 16:15:51 2020 +0200

    tests: fix test_replay; do only use aware datetime objects
    
    naive dates being now properly forbidden.

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/165/ for more details.

vlorentz added a subscriber: vlorentz.

we usually define a now() function at the beginning of modules to return an aware datetime, but that's ok too

This revision is now accepted and ready to land.May 11 2020, 5:14 PM

we usually define a now() function at the beginning of modules to return an aware datetime, but that's ok too

I do prefer this to make it visible we do create an aware date object in the code (or the function should be called something more explicit).
Thx.

we usually define a now() function at the beginning of modules to return an aware datetime, but that's ok too

I do prefer this to make it visible we do create an aware date object in the code (or the function should be called something more explicit).
Thx.

We define one in swh.storage.utils.now [1]

Maybe that should be reworked as you discussed?

[1] https://forge.softwareheritage.org/source/swh-storage/browse/master/swh/storage/utils.py$14-15