Page MenuHomeSoftware Heritage

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

Authored by ardumont on Fri, Jun 19, 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

Diff Detail

Repository
rDLDBASE Generic VCS/Package Loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont created this revision.Fri, Jun 19, 5:54 PM

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.

ardumont edited the summary of this revision. (Show Details)
ardumont edited the summary of this revision. (Show Details)
olasd accepted this revision.Fri, Jun 19, 6:11 PM
This revision is now accepted and ready to land.Fri, Jun 19, 6:11 PM
olasd removed a reviewer: olasd.Fri, Jun 19, 6:12 PM
This revision now requires review to proceed.Fri, Jun 19, 6:12 PM
olasd requested changes to this revision.Fri, Jun 19, 6:21 PM
olasd added inline comments.
swh/loader/tests/common.py
2

lies! ;)

13

assert_last_visit_matches would be more descriptive, I believe.

30

Check that the returned visit has the given type

31

Check that the visit status points to the given snapshot

35

if... ?

42–43

Should probably just be an assert too?

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

46

s/with/has/

49

s/with/has/

53

s/with/points to/

This revision now requires changes to proceed.Fri, Jun 19, 6:21 PM
ardumont updated this revision to Diff 11767.Fri, Jun 19, 6:45 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.

ardumont marked 9 inline comments as done.Fri, Jun 19, 6:55 PM

Thanks for all the good suggestions, fixed!

Cheers,

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