From ce226264eb75e089ff898dcc1021fb1b19b27c45 Mon Sep 17 00:00:00 2001 From: Antoine Lambert <anlambert@softwareheritage.org> Date: Fri, 3 May 2024 13:54:38 +0200 Subject: [PATCH] pytest_plugin: Port code to updated swh-scheduler API The oldest part of the scheduler API was updated to use model classes (based on attr package) instead of dictionaries in order to improve typing. --- requirements-swh.txt | 2 +- requirements-test.txt | 4 ++-- swh/loader/pytest_plugin.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/requirements-swh.txt b/requirements-swh.txt index 75048061..540c505b 100644 --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,5 +1,5 @@ swh.core >= 2.23.0 swh.model >= 6.13.0 swh.objstorage >= 0.2.2 -swh.scheduler >= 0.4.0 +swh.scheduler >= 2.3.0 swh.storage >= 2.0.0 diff --git a/requirements-test.txt b/requirements-test.txt index ba4ed4b2..63d66e7c 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,9 +3,9 @@ pytest-mock requests_mock >= 1.11.0 urllib3 swh-core[testing] -swh-scheduler[testing] >= 2.0.0 +swh.scheduler[testing] >= 2.3.0 swh-storage[testing] >= 2.0.0 -swh-vault +swh-vault >= 1.12.2 types-click types-python-dateutil types-pyyaml diff --git a/swh/loader/pytest_plugin.py b/swh/loader/pytest_plugin.py index 62338a06..19e9db97 100644 --- a/swh/loader/pytest_plugin.py +++ b/swh/loader/pytest_plugin.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2023 The Software Heritage developers +# Copyright (C) 2019-2024 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 @@ -11,7 +11,7 @@ import yaml from swh.loader.core.utils import download, get_url_body from swh.scheduler.model import ListedOrigin, Lister -from swh.scheduler.utils import create_origin_task_dict +from swh.scheduler.utils import create_origin_task @pytest.fixture @@ -74,11 +74,11 @@ def loading_task_creation_for_listed_origin_test( mock_load = mocker.patch(f"{loader_class_name}.load") mock_load.return_value = {"status": "eventful"} - task_dict = create_origin_task_dict(listed_origin, lister) + task = create_origin_task(listed_origin, lister) res = swh_scheduler_celery_app.send_task( task_function_name, - kwargs=task_dict["arguments"]["kwargs"], + kwargs=task.arguments.kwargs, ) assert res res.wait() -- GitLab