Page MenuHomeSoftware Heritage

D6849.diff
No OneTemporary

D6849.diff

diff --git a/requirements-test.txt b/requirements-test.txt
--- 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
--- a/swh/loader/cvs/tasks.py
+++ b/swh/loader/cvs/tasks.py
@@ -24,12 +24,7 @@
@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 @@
- 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
--- a/swh/loader/cvs/tests/test_tasks.py
+++ b/swh/loader/cvs/tests/test_tasks.py
@@ -23,3 +23,21 @@
)
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
--- a/tox.ini
+++ b/tox.ini
@@ -6,6 +6,10 @@
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 @@
extras =
testing
deps =
- mypy
+ mypy!=0.920
commands =
mypy swh

File Metadata

Mime Type
text/plain
Expires
Nov 5 2024, 5:04 AM (10 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219396

Event Timeline