Page MenuHomeSoftware Heritage

svn: Unify loader constructor + register worker (tasks, cli)
ClosedPublic

Authored by ardumont on Dec 5 2019, 2:21 PM.

Details

Summary

With this, we stop passing parameters to the load method. We pass those
parameters to the loader's constructor.

  • svn.tasks: Adapt tasks according to the constructor unification
  • svn.tasks: Rename tasks according to production's
  • loader.svn: Register svn worker (scheduler task auto-registration + cli auto-registration)

Related to T2134

Depends D2397

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.Dec 5 2019, 2:21 PM
ardumont edited the summary of this revision. (Show Details)Dec 5 2019, 2:22 PM
ardumont retitled this revision from svn: Unify loader constructor with url as parameter to svn: Unify loader constructor + auto-register worker (tasks, cli).Dec 5 2019, 2:28 PM
ardumont retitled this revision from svn: Unify loader constructor + auto-register worker (tasks, cli) to svn: Unify loader constructor + register worker (tasks, cli).Dec 5 2019, 3:15 PM
anlambert accepted this revision.Dec 6 2019, 1:36 PM
anlambert added a subscriber: anlambert.

Looks good !

swh/loader/svn/__init__.py
9 ↗(On Diff #8451)

s/Mapping/Dict/

swh/loader/svn/tasks.py
1

2019

swh/loader/svn/tests/test_task.py
6 ↗(On Diff #8451)

You should use the mocker fixture from pytest-mock here instead:

def test_svn_loader(
        mocker, swh_app, celery_session_worker, swh_config):
    mock_loader = mocker.patch('swh.loader.svn.loader.SvnLoader.load')
    mock_loader.return_value = {'status': 'eventful'}
This revision is now accepted and ready to land.Dec 6 2019, 1:36 PM
ardumont added inline comments.Dec 6 2019, 1:57 PM
swh/loader/svn/tests/test_task.py
6 ↗(On Diff #8451)

Thanks.
Will look into that.

https://pypi.org/project/pytest-mock/

ardumont updated this revision to Diff 8486.Dec 6 2019, 2:45 PM

Adapt according to review