Page MenuHomeSoftware Heritage

loader.svn: Start tests refactoring with pytest
ClosedPublic

Authored by ardumont on Jul 2 2020, 7:21 PM.

Details

Summary

This starts to align the existing svn tests with the core/package ones. For
now, utilities functions are in this repository close to the tests. They will
most possibly be refactored out in swh-loader-core at some point.

Related to T2462

Test Plan

tox

Diff Detail

Repository
rDLDSVN Subversion (SVN) 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.Jul 2 2020, 7:21 PM

Build is green

Patch application report for D3397 (id=12047)

Rebasing onto ee23fd7582...

Current branch diff-target is up to date.
Changes applied before test
commit 9394be5c0af0d837a197c91ea11050ef1fcafee2
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Jul 2 19:19:13 2020 +0200

    Start tests refactoring with pytest
    
    This starts to align the existing svn tests with the core/package ones. For
    now, utilities functions are in this repository close to the tests. They will
    most possibly be refactored out in swh-loader-core at some point.
    
    Related to T2462

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

ardumont added inline comments.Jul 2 2020, 7:33 PM
swh/loader/svn/tests/test_loader.py
14

Maybe those need to move to swh.loader.tests.common instead now...

190

That's coming from [1] which I intend more or less to rewrite slowly and when we need to.
At some point, that should go back in swh-loader-core.

[1] https://forge.softwareheritage.org/source/swh-loader-core/browse/master/swh/loader/core/tests/__init__.py$207-227

ardumont updated this revision to Diff 12051.Jul 3 2020, 7:34 AM

Rework commit message

Build is green

Patch application report for D3397 (id=12051)

Rebasing onto ee23fd7582...

Current branch diff-target is up to date.
Changes applied before test
commit 5d770ec3934b84413b13b63a19443592832c8e0a
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Jul 2 19:19:13 2020 +0200

    Start tests with pytest refactoring: Add scenario for 1 visit
    
    This starts to align the existing svn tests with the core/package ones. For
    now, utilities functions are in this repository close to the tests. They will
    most possibly be refactored out in swh-loader-core at some point.
    
    Related to T2462

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

vlorentz accepted this revision.Jul 3 2020, 9:46 AM
vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/loader/svn/tests/conftest.py
62

Could you explain why this is needed?

This revision is now accepted and ready to land.Jul 3 2020, 9:46 AM
ardumont added inline comments.Jul 3 2020, 9:51 AM
swh/loader/svn/tests/conftest.py
62

in comment or in here?

datadir targets by default a "data" folder within the tests folder.
In that repository it's named "resources" so we need the override to be able to use it in here.

I intend this to be "data" when i'm done refactoring ;)
So I did not bother much in the docstring.

vlorentz added inline comments.Jul 3 2020, 9:51 AM
swh/loader/svn/tests/conftest.py
62

Either.

But why not rename it now?

ardumont added inline comments.Jul 3 2020, 9:55 AM
swh/loader/svn/tests/conftest.py
62

Because that will touch other parts of the code as well.
And i'm trying to keep diff tidy for you all reviewers to not get lost in a gazillion lines of unnecessary diffs.

ardumont updated this revision to Diff 12060.Jul 3 2020, 10:37 AM

Explain datadir override

Build is green

Patch application report for D3397 (id=12060)

Rebasing onto ee23fd7582...

Current branch diff-target is up to date.
Changes applied before test
commit 5c46affea65d6fb9a922d4f6ff0ab8920e121db8
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Jul 2 19:19:13 2020 +0200

    Start tests with pytest refactoring: Add scenario for 1 visit
    
    This starts to align the existing svn tests with the core/package ones. For
    now, utilities functions are in this repository close to the tests. They will
    most possibly be refactored out in swh-loader-core at some point.
    
    Related to T2462

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