diff --git a/requirements-test.txt b/requirements-test.txt index e079f8a6038dd2dc8512967540f96ee0de172067..584dbb57981fd9b8d16a7acc37299285f0ecfb25 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1 +1,2 @@ pytest +swh.scheduler[testing] diff --git a/swh/loader/cvs/tasks.py b/swh/loader/cvs/tasks.py index 63867dc2a5883f219005452438633eb250a2d0ae..a3753ba75ad42b8d6f1a65d4ce9e3ba47080480f 100644 --- a/swh/loader/cvs/tasks.py +++ b/swh/loader/cvs/tasks.py @@ -24,12 +24,7 @@ def convert_to_datetime(date: Optional[str]) -> Optional[datetime]: @shared_task(name=__name__ + ".LoadCvsRepository") def load_cvs( - *, - url: str, - origin_url: Optional[str] = None, - destination_path: Optional[str] = None, - swh_revision: Optional[str] = None, - visit_date: Optional[str] = None, + *, url: str, origin_url: Optional[str] = None, visit_date: Optional[str] = None, ): """Import a CVS repository @@ -37,18 +32,9 @@ def load_cvs( - url: (mandatory) CVS's repository url to ingest data from - origin_url: Optional original url override to use as origin reference in the archive. If not provided, "url" is used as origin. - - destination_path: (optional) root directory to - locally retrieve svn's data - - swh_revision: (optional) extra revision hex to - start from. See swh.loader.svn.CvsLoader.process - docstring - visit_date: Optional date to override the visit date """ loader = CvsLoader.from_configfile( - url=url, - origin_url=origin_url, - destination_path=destination_path, - swh_revision=swh_revision, - visit_date=convert_to_datetime(visit_date), + url=url, origin_url=origin_url, visit_date=convert_to_datetime(visit_date), ) return loader.load() diff --git a/swh/loader/cvs/tests/test_tasks.py b/swh/loader/cvs/tests/test_tasks.py index 332c43e41cfbca528985a7af5e410b4a73a2c3eb..126fd3c3cfe05f676287883eb1a7c57bafa6330e 100644 --- a/swh/loader/cvs/tests/test_tasks.py +++ b/swh/loader/cvs/tests/test_tasks.py @@ -23,3 +23,21 @@ from swh.loader.cvs.tasks import convert_to_datetime ) def test_convert_to_datetime(date, expected_result): assert convert_to_datetime(date) == expected_result + + +def test_cvs_loader( + mocker, swh_scheduler_celery_app, swh_scheduler_celery_worker, swh_config +): + mock_loader = mocker.patch("swh.loader.cvs.loader.CvsLoader.load") + mock_loader.return_value = {"status": "eventful"} + + res = swh_scheduler_celery_app.send_task( + "swh.loader.cvs.tasks.LoadCvsRepository", + kwargs=dict(url="some-technical-url", origin_url="origin-url"), + ) + assert res + res.wait() + assert res.successful() + + assert res.result == {"status": "eventful"} + assert mock_loader.called diff --git a/tox.ini b/tox.ini index 010ee68640ac7f8b648bed2b3f036b3e923a53a6..a218910f7f553d5422417ca5b267167910f9ee82 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,10 @@ extras = testing deps = pytest-cov + # the dependency below is needed for now as a workaround for + # https://github.com/pypa/pip/issues/6239 + # TODO: remove when this issue is fixed + swh.scheduler[testing] commands = pytest --doctest-modules \ {envsitepackagesdir}/swh/loader/cvs \ @@ -30,7 +34,7 @@ commands = extras = testing deps = - mypy + mypy!=0.920 commands = mypy swh