diff --git a/swh/loader/cli.py b/swh/loader/cli.py --- a/swh/loader/cli.py +++ b/swh/loader/cli.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2021 The Software Heritage developers +# Copyright (C) 2019-2022 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 @@ -77,7 +77,7 @@ ctx.obj["config"] = read(config_file) logger.debug("config_file: %s", config_file) - logger.debug("config: ", ctx.obj["config"]) + logger.debug("config: %s", ctx.obj["config"]) @loader.command(name="run", context_settings=CONTEXT_SETTINGS) @@ -93,7 +93,10 @@ conf = ctx.obj.get("config", {}) if "storage" not in conf: - raise ValueError("Missing storage configuration key") + logger.warning( + "No storage configuration detected, using an in-memory storage instead." + ) + conf["storage"] = {"cls": "memory"} (_, kw) = parse_options(options) logger.debug(f"kw: {kw}") diff --git a/swh/loader/tests/test_cli.py b/swh/loader/tests/test_cli.py --- a/swh/loader/tests/test_cli.py +++ b/swh/loader/tests/test_cli.py @@ -1,15 +1,13 @@ -# Copyright (C) 2019-2021 The Software Heritage developers +# Copyright (C) 2019-2022 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 datetime -import os from click.formatting import HelpFormatter from click.testing import CliRunner import pytest -import yaml from swh.loader.cli import SUPPORTED_LOADERS, get_loader from swh.loader.cli import loader as loader_cli @@ -66,28 +64,6 @@ assert result.output.startswith((usage_prefix, usage_prefix2)) -def test_run_with_configuration_failure(tmp_path): - """Triggering a load should fail since configuration is incomplete""" - runner = CliRunner() - - conf_path = os.path.join(str(tmp_path), "cli.yml") - with open(conf_path, "w") as f: - f.write(yaml.dump({})) - - with pytest.raises(ValueError, match="Missing storage"): - runner.invoke( - loader_cli, - [ - "-C", - conf_path, - "run", - "pypi", - "url=https://some-url", - ], - catch_exceptions=False, - ) - - def test_run_pypi(mocker, swh_config): """Triggering a load should be ok""" mock_loader = mocker.patch("swh.loader.package.pypi.loader.PyPILoader.load")