Page MenuHomeSoftware Heritage

Move remaining common test utility functions to top-level arborescence
ClosedPublic

Authored by ardumont on Jul 6 2020, 3:34 PM.

Details

Summary

It's shared amongst both package and core loaders.

I intend to migrate the other dvcs loaders with the following change.

It's just code moving to a common arborescence tree.

Related to T2481

Test Plan

tox

Diff Detail

Event Timeline

Build is green

Patch application report for D3433 (id=12151)

Could not rebase; Attempt merge onto aafac87f5c...

Updating aafac87..d2bbe62
Fast-forward
 MANIFEST.in                                      |   1 +
 swh/loader/core/tests/__init__.py                |   2 +-
 swh/loader/core/tests/test_loader.py             |   2 +-
 swh/loader/package/archive/tests/test_archive.py |   6 +-
 swh/loader/package/cran/tests/test_cran.py       |   4 +-
 swh/loader/package/debian/tests/test_debian.py   |   4 +-
 swh/loader/package/deposit/tests/test_deposit.py |   6 +-
 swh/loader/package/nixguix/tests/test_nixguix.py |  11 +-
 swh/loader/package/npm/tests/test_npm.py         |   6 +-
 swh/loader/package/pypi/tests/test_pypi.py       |   6 +-
 swh/loader/package/tests/common.py               |  82 --------
 swh/loader/package/tests/test_common.py          |  89 +-------
 swh/loader/tests/__init__.py                     | 160 ++++++++++++++
 swh/loader/tests/common.py                       |  53 -----
 swh/loader/tests/data/0805nexter-1.1.0.tar.gz    |   1 +
 swh/loader/tests/test_common.py                  | 118 -----------
 swh/loader/tests/test_init.py                    | 253 +++++++++++++++++++++++
 17 files changed, 440 insertions(+), 364 deletions(-)
 delete mode 100644 swh/loader/tests/common.py
 create mode 120000 swh/loader/tests/data/0805nexter-1.1.0.tar.gz
 delete mode 100644 swh/loader/tests/test_common.py
 create mode 100644 swh/loader/tests/test_init.py
Changes applied before test
commit d2bbe620b0185726b4b2428fd81b3845e7e6f362
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jul 6 15:30:17 2020 +0200

    Move remaining common test utility functions to top-level arborescence
    
    It's shared amongst both package and core loaders.
    
    Related to T2481

commit 373e9a16e967ad241865b69f1d8cbdf188b86bac
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jul 6 14:49:40 2020 +0200

    Move common test utility function to the top-level arborescence
    
    It's shared amongst both package and core loaders.
    
    Related to T2481

commit 3348e522ccfd8a217c015eada42731cbbc7ca0a3
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jul 6 14:41:05 2020 +0200

    Define common test helper function
    
    Related to T2481

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

Using the right commit to update a diff is better.

Build is green

Patch application report for D3433 (id=12170)

Rebasing onto 3348e522cc...

Current branch diff-target is up to date.
Changes applied before test
commit 4084012c0ad7e451ed229c0dc8220543591adc65
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jul 6 14:49:40 2020 +0200

    Move common test utility function to the top-level arborescence
    
    It's shared amongst both package and core loaders.
    
    Related to T2481

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

Build is green

Patch application report for D3433 (id=12171)

Could not rebase; Attempt merge onto 3348e522cc...

Updating 3348e52..d234a5c
Fast-forward
 swh/loader/core/tests/test_loader.py             |   2 +-
 swh/loader/package/archive/tests/test_archive.py |   6 +-
 swh/loader/package/cran/tests/test_cran.py       |   4 +-
 swh/loader/package/debian/tests/test_debian.py   |   4 +-
 swh/loader/package/deposit/tests/test_deposit.py |   6 +-
 swh/loader/package/nixguix/tests/test_nixguix.py |  11 +-
 swh/loader/package/npm/tests/test_npm.py         |   6 +-
 swh/loader/package/pypi/tests/test_pypi.py       |   6 +-
 swh/loader/package/tests/common.py               |  82 ---------
 swh/loader/package/tests/test_common.py          |  89 +---------
 swh/loader/tests/__init__.py                     | 132 ++++++++++++++-
 swh/loader/tests/common.py                       |  53 ------
 swh/loader/tests/test_common.py                  | 118 -------------
 swh/loader/tests/test_init.py                    | 207 ++++++++++++++++++++++-
 14 files changed, 360 insertions(+), 366 deletions(-)
 delete mode 100644 swh/loader/tests/common.py
 delete mode 100644 swh/loader/tests/test_common.py
Changes applied before test
commit d234a5c74c2b4bafb2f22b7061662062ebbda761
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jul 6 15:30:17 2020 +0200

    Move remaining common test utility functions to top-level arborescence
    
    It's shared amongst both package and core loaders.
    
    Related to T2481

commit 4084012c0ad7e451ed229c0dc8220543591adc65
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jul 6 14:49:40 2020 +0200

    Move common test utility function to the top-level arborescence
    
    It's shared amongst both package and core loaders.
    
    Related to T2481

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

swh/loader/tests/__init__.py
130

Just noticed this is not covered.
It must be through the dvcs loader tests though, i guess.

I'll add coverage in a follow-up diff.
In the mean time [1]

[1] T2486

This revision is now accepted and ready to land.Jul 7 2020, 9:58 AM
swh/loader/tests/__init__.py
130

Oh, i recall now, it's utility code to display the snapshot in case we don't find it.
So that code can even be removed, it's only used for the in-memory storage.
And now the tests are running with a pg-storage.

I'll let it be as it's not in the diff's perimeter.