Page MenuHomeSoftware Heritage

test_loader: Use a spec'ed mock, to follow the new style guide
AbandonedPublic

Authored by vlorentz on Mar 25 2021, 7:21 PM.

Details

Reviewers
None
Group Reviewers
Reviewers
Summary

Depends on D5346

Event Timeline

Build is green

Patch application report for D5347 (id=19159)

Could not rebase; Attempt merge onto 6d3545e47b...

Updating 6d3545e..6e04a21
Fast-forward
 swh/loader/package/debian/loader.py              |  4 +-
 swh/loader/package/debian/tests/test_debian.py   | 36 +++++++-----
 swh/loader/package/loader.py                     | 72 ++++++++++++------------
 swh/loader/package/nixguix/tests/test_nixguix.py |  6 +-
 swh/loader/package/tests/test_loader.py          | 26 +++++----
 5 files changed, 79 insertions(+), 65 deletions(-)
Changes applied before test
commit 6e04a21df73e3d208b50159e78b52b1d6443ea83
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Mar 25 14:52:37 2021 +0100

    test_loader: Use a spec'ed mock, to follow the new style guide

commit 2f9b8a8b1eecb578cdcbe9046262b6087a6c15de
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Mar 25 10:47:03 2021 +0100

    Rename resolve_revision_from with _artifacts suffix, and fix its documentation
    
    A future commit will introduce resolve_revision_from_extid, so this commit
    preemptively renames it to avoid any confusion.

commit 78430078cd2647e09cc9a0c09a9e6179d4a0d8b1
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Mar 23 16:14:42 2021 +0100

    package.loader: Unnest loops in PackageLoader.load()
    
    In a future commit, we will need to go through all the PackageInfo
    objects before running the loop, so we can get their ExtID and
    fetch them from the storage.
    
    So, we need to fetch them all before running the load loop,
    using this listcomp.

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

ardumont added inline comments.
swh/loader/package/tests/test_loader.py
73

i'm not sure i get it better now.

Does that modify on the fly the returned value when calling StubPackageInfo.extid() ?

swh/loader/package/tests/test_loader.py
73

yes, it's a nonlocal variable.

I agree it's confusing though. I can drop this diff.

ardumont added inline comments.
swh/loader/package/tests/test_loader.py
73

Maybe it's better to drop it.
It's more code with less clear readability.

This revision is now accepted and ready to land.Mar 26 2021, 9:23 AM

mmm i did not intend to do that...

This revision now requires changes to proceed.Mar 26 2021, 9:24 AM
This revision now requires review to proceed.Mar 26 2021, 9:24 AM