Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/tests/conftest.py
# Copyright (C) 2019-2020 The Software Heritage developers | # Copyright (C) 2019-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import os | import os | ||||
import yaml | import yaml | ||||
import pytest | import pytest | ||||
from typing import Any, Dict | from typing import Any, Dict | ||||
from swh.scheduler.tests.conftest import * # noqa | |||||
from swh.storage.tests.conftest import * # noqa | |||||
@pytest.fixture | @pytest.fixture | ||||
def swh_loader_config(swh_storage_backend_config, tmp_path) -> Dict[str, Any]: | def swh_loader_config(swh_storage_backend_config, tmp_path) -> Dict[str, Any]: | ||||
swh_storage_backend_config["journal_writer"] = {} | swh_storage_backend_config["journal_writer"] = {} | ||||
return { | return { | ||||
"storage": { | "storage": { | ||||
"cls": "pipeline", | "cls": "pipeline", | ||||
"steps": [ | "steps": [ | ||||
Show All 25 Lines | |||||
@pytest.fixture | @pytest.fixture | ||||
def swh_config(swh_loader_config, monkeypatch, tmp_path): | def swh_config(swh_loader_config, monkeypatch, tmp_path): | ||||
conffile = os.path.join(str(tmp_path), "loader.yml") | conffile = os.path.join(str(tmp_path), "loader.yml") | ||||
with open(conffile, "w") as f: | with open(conffile, "w") as f: | ||||
f.write(yaml.dump(swh_loader_config)) | f.write(yaml.dump(swh_loader_config)) | ||||
monkeypatch.setenv("SWH_CONFIG_FILENAME", conffile) | monkeypatch.setenv("SWH_CONFIG_FILENAME", conffile) | ||||
return conffile | return conffile | ||||
@pytest.fixture(scope="session") # expected redefinition | |||||
def celery_includes(): | |||||
return [ | |||||
"swh.loader.mercurial.tasks", | |||||
] |