Page MenuHomeSoftware Heritage

tests: Remove duplicate checks

Authored by vlorentz on Thu, Nov 4, 5:59 PM.


Group Reviewers

All the '*_missing' tests are already done automatically by check_snapshot
(it recursively checks all objects are present in the storage).

Depends on D6607.

Diff Detail

rDLDBASE Generic VCS/Package Loader
No Linters Available
No Unit Test Coverage
Build Status
Buildable 24883
Build 38871: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 38870: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D6613 (id=24010)

Could not rebase; Attempt merge onto 5063082e7d...

Updating 5063082..6e8dfdc
 docs/package-loader-tutorial.rst                 |  25 +++
 swh/loader/package/archive/tests/ |  20 +-
 swh/loader/package/cran/tests/       |  19 +-
 swh/loader/package/debian/tests/   |  80 +++++---
 swh/loader/package/deposit/             |   5 -
 swh/loader/package/deposit/tests/ |  78 ++++++--
 swh/loader/package/nixguix/tests/ |  31 ++-
 swh/loader/package/npm/tests/         |  83 ++++----
 swh/loader/package/opam/                |  41 +++-
 swh/loader/package/opam/tests/       |  83 +++++++-
 swh/loader/package/pypi/tests/       | 243 +++++++----------------
 swh/loader/tests/                     |  18 +-
 swh/loader/tests/                    |   4 +-
 13 files changed, 421 insertions(+), 309 deletions(-)
Changes applied before test
commit 6e8dfdcb5d2f6841e6b2756440e200a17feb32f6
Author: Valentin Lorentz <>
Date:   Thu Nov 4 17:58:37 2021 +0100

    tests: Remove duplicate checks
    All the '*_missing' tests are already done automatically by check_snapshot
    (it recursively checks all objects are present in the storage).

commit 177e41e1f4a53f117cdf9ec8f5d2939e8a446bac
Author: Valentin Lorentz <>
Date:   Thu Nov 4 17:53:20 2021 +0100

    tests: Hide utilities from stack traces
    They clutter the test output because pytest prints the whole code
    of the function raising the assertionerror.
    With this magic variable, the error is shown as if it was raised
    directly in the caller's body.

commit dffd6387dfcdc4bb535c13916299d246c0f4d169
Author: Valentin Lorentz <>
Date:   Thu Nov 4 15:49:45 2021 +0100

    package loaders: Make test failures more helpful
    Some tests did the following:
    1. build a snapshot
    2. get the snapshot from the storage
    3. compare it with the expected snapshot
    4. get the origin visit from the storage and check it
    If the loader built a wrong snapshot, the test fails at step 2,
    and the only information displayed is that the expected snapshot id
    does not exist, which is very unhelpful.
    Instead, I reordered them as: 1, 4, 2, 3. This way, if a wrong
    snapshot is build by the loader, it is detected when comparing
    the visit, and pytest shows the two hashes.
    Then, the test can be modified to use the hash that is actually
    generated to show the actual snapshot.
    This is consistent with what was already done in the pypi loader.
    Additionally, I made the following changes:
    1. always check stats last (because a difference in numbers is
       hardly actionable without testing other objects)
    2. add a few more snapshot id checks in visits
    3. deduplicated a hardcoded snapshot id.

commit 65ee04b10025474c59e0521aab7b847a74b38b00
Author: Valentin Lorentz <>
Date:   Thu Oct 21 14:35:47 2021 +0200

    deposit: Remove 'parent' deposit
    The parent is computed by the deposit as the revision of the latest deposit
    in the same origin before the current one.
    Therefore, it is redundant, as it can be recomputed from metadata
    + revision date.
    This is a preliminary change needed to make package loaders produce
    releases instead of revisions, as releases don't have parent relationships

commit 0d04182ecce3ab34c2ed648bbafa83ab5204e0b0
Author: Valentin Lorentz <>
Date:   Thu Nov 4 11:45:36 2021 +0100

    opam: Write package definitions to the extrinsic metadata storage

commit 18bbbae719fc9d165d5b543e54d449f5befc083a
Author: Valentin Lorentz <>
Date:   Thu Nov 4 11:43:53 2021 +0100

    Add missing documentation for `get_metadata_authority`.

See for more details.

This revision is now accepted and ready to land.Fri, Nov 5, 11:20 AM