diff --git a/swh/lister/cgit/tasks.py b/swh/lister/cgit/tasks.py index 9a9564894a929a49c51bf0a1f2e6f77529b6121a..e912a4df2dbd9f983c61c7d2b831f6d436da26c5 100644 --- a/swh/lister/cgit/tasks.py +++ b/swh/lister/cgit/tasks.py @@ -1,8 +1,8 @@ -# Copyright (C) 2019-2021 The Software Heritage developers +# Copyright (C) 2019 The Software Heritage developers # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from typing import Dict, Optional +from typing import Dict from celery import shared_task @@ -10,13 +10,9 @@ from .lister import CGitLister @shared_task(name=__name__ + ".CGitListerTask") -def list_cgit( - url: str, instance: Optional[str] = None, base_git_url: Optional[str] = None -) -> Dict[str, str]: +def list_cgit(**lister_args) -> Dict[str, str]: """Lister task for CGit instances""" - lister = CGitLister.from_configfile( - url=url, instance=instance, base_git_url=base_git_url - ) + lister = CGitLister.from_configfile(**lister_args) return lister.run().dict() diff --git a/swh/lister/cgit/tests/test_tasks.py b/swh/lister/cgit/tests/test_tasks.py index ce08c6962eeedc33e3ea7d40eb308e0a15a35378..2c95ee3ce6d186efd9590be84e87d13221f0802f 100644 --- a/swh/lister/cgit/tests/test_tasks.py +++ b/swh/lister/cgit/tests/test_tasks.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2021 The Software Heritage developers +# Copyright (C) 2019 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -22,7 +22,9 @@ def test_cgit_lister_task( lister.from_configfile.return_value = lister lister.run.return_value = ListerStats(pages=10, origins=500) - kwargs = dict(url="https://git.kernel.org/", instance="kernel", base_git_url=None) + kwargs = dict( + url="https://git.kernel.org/", instance="kernel", base_git_url=None, max_pages=1 + ) res = swh_scheduler_celery_app.send_task( "swh.lister.cgit.tasks.CGitListerTask",