diff --git a/conftest.py b/conftest.py index 71afc47..cd5ed25 100644 --- a/conftest.py +++ b/conftest.py @@ -1,68 +1,67 @@ # Copyright (C) 2019-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 os import pytest import yaml from typing import Any, Dict -from swh.storage.tests.conftest import * # noqa -from swh.scheduler.tests.conftest import * # noqa +from swh.scheduler.tests.conftest import swh_app # noqa @pytest.fixture def swh_loader_config(swh_storage_postgresql) -> Dict[str, Any]: return { "storage": { "cls": "pipeline", "steps": [ {"cls": "retry"}, {"cls": "filter"}, {"cls": "buffer"}, { "cls": "local", "db": swh_storage_postgresql.dsn, "objstorage": {"cls": "memory", "args": {}}, }, ], }, "deposit": { "url": "https://deposit.softwareheritage.org/1/private", "auth": {"username": "user", "password": "pass",}, }, } @pytest.fixture def swh_config(swh_loader_config, monkeypatch, tmp_path): conffile = os.path.join(str(tmp_path), "loader.yml") with open(conffile, "w") as f: f.write(yaml.dump(swh_loader_config)) monkeypatch.setenv("SWH_CONFIG_FILENAME", conffile) return conffile @pytest.fixture(autouse=True, scope="session") def swh_proxy(): """Automatically inject this fixture in all tests to ensure no outside connection takes place. """ os.environ["http_proxy"] = "http://localhost:999" os.environ["https_proxy"] = "http://localhost:999" @pytest.fixture(scope="session") # type: ignore # expected redefinition def celery_includes(): return [ "swh.loader.package.archive.tasks", "swh.loader.package.cran.tasks", "swh.loader.package.debian.tasks", "swh.loader.package.deposit.tasks", "swh.loader.package.npm.tasks", "swh.loader.package.pypi.tasks", "swh.loader.package.nixguix.tasks", ] diff --git a/requirements-swh.txt b/requirements-swh.txt index 9cf7880..2d0f2ec 100644 --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,4 +1,4 @@ swh.core >= 0.0.75 swh.model >= 0.3.7 -swh.scheduler -swh.storage >= 0.8.0 +swh.scheduler >= 0.4.0 +swh.storage >= 0.10.1 diff --git a/requirements-test.txt b/requirements-test.txt index 368666f..aab3d89 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,6 @@ pytest pytest-mock -pytest-postgresql >= 2.1.0 requests_mock swh-core[testing] swh-scheduler[testing] +swh-storage[testing] diff --git a/tox.ini b/tox.ini index 456c7aa..e5faf28 100644 --- a/tox.ini +++ b/tox.ini @@ -1,36 +1,37 @@ [tox] envlist=black,flake8,mypy,py3 [testenv] extras = testing deps = swh.core[http] + swh.storage[testing] # otherwise, somehow pytest-postgresql is not seen pytest-cov dev: pdbpp commands = pytest \ !dev: --cov={envsitepackagesdir}/swh/loader/ --cov-branch \ {envsitepackagesdir}/swh/loader/ {posargs} [testenv:black] skip_install = true deps = black commands = {envpython} -m black --check swh [testenv:flake8] skip_install = true deps = flake8 commands = {envpython} -m flake8 [testenv:mypy] extras = testing deps = mypy commands = mypy swh