Page MenuHomeSoftware Heritage

loader.hg: Initialize and refactor deprecated tests to use pytest fixture
ClosedPublic

Authored by ardumont on Jul 7 2020, 9:32 AM.

Details

Summary

This starts the refactoring of the loader-mercurial tests to use pytest. Taking
the same path we did for loader-svn [1] (one test at a time).

Hopefully, at some point, we will be able to reuse those tests for D3435,
maybe?

Note: This will allow to remove the unit-test based tests scaffolding from the
loader-core (once done).

Related to T2481

[1] T2462

Test Plan

tox

Diff Detail

Repository
rDLDHG Mercurial loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build has FAILED

Patch application report for D3440 (id=12176)

Rebasing onto d210f73957...

Current branch diff-target is up to date.
Changes applied before test
commit 54e14bf7e632f4a26d1603185954d3c4a9377078
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Jul 3 16:00:24 2020 +0200

    Initialize and refactor deprecated tests to use pytest
    
    This will allow to remove the base tests scaffolding in core.
    
    Related to T2462

Link to build: https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/16/
See console output for more information: https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/16/console

build has FAILED

ah, yeah the master build is broken [1]
So that needs to be rebased on the fix.

[1] https://jenkins.softwareheritage.org/job/DLDHG/job/tests/691/console

swh/loader/mercurial/tests/test_loader.py
59

That's D3431 but trying to keep things sandboxed (as the latest swh.loader.core is not released yet)

requirements-test.txt
2

yes, should be swh.storage[testing] plus the duplication in tox.ini.

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
requirements-test.txt
2

could you write this in a comment?

swh/loader/mercurial/tests/conftest.py
42

use pytest's tmpdir fixture

This revision is now accepted and ready to land.Jul 7 2020, 10:03 AM
requirements-test.txt
2

Well, that will go away soonishly as i plan to do as entertained as exchanged [1].
The gist of it is to expose a swh.storage.pytest_plugin.
Would that be clear enough?

[1] D3428#inline-23730

swh/loader/mercurial/tests/conftest.py
42

oh yeah ;)

  • Rebase on latest master (green build)
  • Adapt using the latest swh.loader.core testing functions

Build is green

Patch application report for D3440 (id=12195)

Rebasing onto 92e2ad85a7...

Current branch diff-target is up to date.
Changes applied before test
commit 2308eca5f55865f970dbb2b572c02c92cb3a464e
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Jul 3 16:00:24 2020 +0200

    Initialize and refactor deprecated tests to use pytest
    
    This will allow to remove the base tests scaffolding in core.
    
    Related to T2462

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

This starts the refactoring of the loader-mercurial tests to use pytest. Taking
the same path we did for loader-svn [1] (one test at a time).

I'm not sure this is the right path though (i mean 1 diff, 1 refactored test).
I see the pattern to test is quite similar to the git tests ones (using a base class
to test multiple loader implementations).

As a new one is underway, better keep this so we can simply add/replace the implementation to check when ready. maybe?

I'm not sure this is the right path though (i mean 1 diff, 1 refactored test).

Well, sure. Nonetheless, that one is unrelated to other tests so let's land it.
I'll have another look when i'm done with the main part.