Skip to content
Snippets Groups Projects
Commit efe886a0 authored by Nicolas Dandrimont's avatar Nicolas Dandrimont
Browse files

Clean up the swh.scheduler / swh.storage pytest plugin imports

parent fe5e4d34
No related branches found
No related tags found
1 merge request!41Clean up the swh.scheduler / swh.storage pytest plugin imports
# Copyright (C) 2020 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
import pytest
pytest_plugins = ["swh.scheduler.pytest_plugin", "swh.storage.pytest_plugin"]
@pytest.fixture(scope="session")
def swh_scheduler_celery_includes(swh_scheduler_celery_includes):
return swh_scheduler_celery_includes + [
"swh.loader.svn.tasks",
]
[pytest]
# Drop this when these fixtures aren't imported automatically
addopts = -p no:pytest_swh_scheduler -p no:pytest_swh_storage
norecursedirs = docs
markers =
fs: execute tests that write to the filesystem
......@@ -9,9 +9,6 @@ import yaml
from typing import Any, Dict
from swh.scheduler.tests.conftest import swh_app # noqa
from swh.storage.tests.conftest import * # noqa
@pytest.fixture
def swh_loader_config(swh_storage_backend_config) -> Dict[str, Any]:
......@@ -50,10 +47,3 @@ def swh_config(swh_loader_config, monkeypatch, tmp_path):
f.write(yaml.dump(swh_loader_config))
monkeypatch.setenv("SWH_CONFIG_FILENAME", conffile)
return conffile
@pytest.fixture(scope="session")
def celery_includes():
return [
"swh.loader.svn.tasks",
]
......@@ -4,11 +4,13 @@
# See top-level LICENSE file for more information
def test_svn_loader(mocker, swh_app, celery_session_worker, swh_config):
def test_svn_loader(
mocker, swh_scheduler_celery_app, swh_scheduler_celery_worker, swh_config
):
mock_loader = mocker.patch("swh.loader.svn.loader.SvnLoader.load")
mock_loader.return_value = {"status": "eventful"}
res = swh_app.send_task(
res = swh_scheduler_celery_app.send_task(
"swh.loader.svn.tasks.LoadSvnRepository",
kwargs=dict(url="some-technical-url", origin_url="origin-url"),
)
......@@ -19,11 +21,13 @@ def test_svn_loader(mocker, swh_app, celery_session_worker, swh_config):
assert res.result == {"status": "eventful"}
def test_svn_loader_from_dump(mocker, swh_app, celery_session_worker, swh_config):
def test_svn_loader_from_dump(
mocker, swh_scheduler_celery_app, swh_scheduler_celery_worker, swh_config
):
mock_loader = mocker.patch("swh.loader.svn.loader.SvnLoaderFromDumpArchive.load")
mock_loader.return_value = {"status": "eventful"}
res = swh_app.send_task(
res = swh_scheduler_celery_app.send_task(
"swh.loader.svn.tasks.MountAndLoadSvnRepository",
kwargs=dict(url="some-url", archive_path="some-path"),
)
......@@ -35,12 +39,12 @@ def test_svn_loader_from_dump(mocker, swh_app, celery_session_worker, swh_config
def test_svn_loader_from_remote_dump(
mocker, swh_app, celery_session_worker, swh_config
mocker, swh_scheduler_celery_app, swh_scheduler_celery_worker, swh_config
):
mock_loader = mocker.patch("swh.loader.svn.loader.SvnLoaderFromRemoteDump.load")
mock_loader.return_value = {"status": "eventful"}
res = swh_app.send_task(
res = swh_scheduler_celery_app.send_task(
"swh.loader.svn.tasks.DumpMountAndLoadSvnRepository",
kwargs=dict(url="some-remote-dump-url", origin_url="origin-url"),
)
......
......@@ -6,6 +6,7 @@ extras =
testing
deps =
pytest-cov
swh.scheduler[testing] >= 0.5.0
dev: pdbpp
commands =
pytest --cov={envsitepackagesdir}/swh/loader/svn \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment