Page MenuHomeSoftware Heritage

Add helper function to ensure loader visit/visit-status are as expected
ClosedPublic

Authored by ardumont on Jun 19 2020, 5:54 PM.

Details

Summary

This bootstraps a new swh.loader.tests.common module to declare common helper
functions we can reuse for all loaders.

(I wonder if putting this directly in swh/loader/tests/__init__.py is not
enough?)

Following a discussion with @olasd, i preferred to open a new diff to decrease the
size of the original one [1]

[1] Related to D3305#inline-22935

Test Plan

tox

Event Timeline

Build is green

Patch application report for D3321 (id=11763)

Rebasing onto e7e27a16cd...

Current branch diff-target is up to date.
Changes applied before test
commit 2b7209f921de49752543d07b06bb3b84afaac6c9
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Jun 19 17:50:36 2020 +0200

    Add helper function to ensure loader visit are as expected
    
    This bootstraps a swh.loader.tests.common module

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

This revision is now accepted and ready to land.Jun 19 2020, 6:11 PM
This revision now requires review to proceed.Jun 19 2020, 6:12 PM
olasd requested changes to this revision.Jun 19 2020, 6:21 PM
olasd added inline comments.
swh/loader/tests/common.py
1

lies! ;)

12

assert_last_visit_matches would be more descriptive, I believe.

29

Check that the returned visit has the given type

30

Check that the visit status points to the given snapshot

34

if... ?

41–42

Should probably just be an assert too?

e.g. assert visit_and_status, f"origin {url} has no visits?"

45

s/with/has/

48

s/with/has/

52

s/with/points to/

This revision now requires changes to proceed.Jun 19 2020, 6:21 PM
ardumont edited the summary of this revision. (Show Details)

Adapt according to review

Build is green

Patch application report for D3321 (id=11767)

Rebasing onto e7e27a16cd...

Current branch diff-target is up to date.
Changes applied before test
commit f4ebf5c3ac3b5c203e744184ae1434baa018a350
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Jun 19 17:50:36 2020 +0200

    Add helper function to ensure loader visit are as expected
    
    This bootstraps a swh.loader.tests.common module

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

Thanks for all the good suggestions, fixed!

Cheers,

This revision is now accepted and ready to land.Jun 22 2020, 10:15 AM