Page MenuHomeSoftware Heritage

tests: Fix execution after swh-storage update
ClosedPublic

Authored by anlambert on Apr 29 2020, 11:50 AM.

Details

Summary

Literal date string must be in valid ISO 8601 format afer recent storage updates.

swh/web/tests/browse/views/test_content.py:35: in <module>
    @given(content_text())
swh/web/tests/strategies.py:101: in content_text
    return content().filter(lambda c: c["mimetype"].startswith("text/"))
swh/web/tests/strategies.py:85: in content
    return _known_swh_object("contents")
swh/web/tests/strategies.py:56: in _known_swh_object
    return sampled_from(get_tests_data()[object_type])
swh/web/tests/data.py:300: in get_tests_data
    _tests_data = _init_tests_data()
swh/web/tests/data.py:181: in _init_tests_data
    snapshot=hash_to_bytes("1a8893e6a86f444e8be8e7bda6cb34fb1735a00e"),
../swh-storage/swh/storage/in_memory.py:862: in origin_visit_update
    self._origin_visit_get_updated(origin_url, visit_id)
../swh-storage/swh/storage/in_memory.py:918: in _origin_visit_get_updated
    visit_update = max(self._origin_visit_statuses[visit_key], key=lambda v: v.date)
E   TypeError: can't compare offset-naive and offset-aware datetimes

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Do you know what update, specifically?

And why did it work so far?

Build is green

Patch application report for D3079 (id=10968)

Rebasing onto 7f3329dca2...

Current branch diff-target is up to date.
Changes applied before test
commit 7babbb8568f1df45082b18d652af15349a494053
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Apr 29 11:47:48 2020 +0200

    tests: Fix execution after swh-storage update
    
    Litteral date strings must be in ISO 8601 format.

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

Do you know what update, specifically?

And why did it work so far?

I guess the change of behavior comes from that commit rDSTOead80889fb44d7c0e929b913f3e852ab851c0a3d,
origin visit format is now checked by swh-model objects.

if this commit changes any behavior, then it's a bug

Hmm you're right, it's using now() in addition to a supplied datetime now.

I'll try to make a diff to forbid naive datetimes, like we should always have

This revision is now accepted and ready to land.Apr 29 2020, 12:04 PM

Build is green

Patch application report for D3079 (id=10969)

Rebasing onto 7f3329dca2...

Current branch diff-target is up to date.
Changes applied before test
commit 16a3ea07e577be29ab9f6d08810591746ddb427c
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Apr 29 11:47:48 2020 +0200

    tests: Fix execution after swh-storage update
    
    Literal date strings must be in ISO 8601 format.

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

Hmm you're right, it's using now() in addition to a supplied datetime now.

I'll try to make a diff to forbid naive datetimes, like we should always have

Ack, I have a similar task for the webapp opened on the subject by the way (T2375).

How come?
I did not tag it yet?

oh with pytest?

oh with pytest?

Yep, mr update is the first thing I do every morning ;-)

I'll try to make a diff to forbid naive datetimes, like we should always have

D3084, but it's only at the RPC layer, so it wouldn't have caught this.