diff --git a/conftest.py b/conftest.py index 785711ba522bf96e833f88ac887829d3392a401c..706148c2e519754b2003f98a5a979af2ea8f1f44 100644 --- a/conftest.py +++ b/conftest.py @@ -1 +1,5 @@ -pytest_plugins = ["swh.storage.pytest_plugin", "swh.core.db.pytest_plugin"] +pytest_plugins = [ + "swh.storage.pytest_plugin", + "swh.core.db.pytest_plugin", + "swh.graph.pytest_plugin", +] diff --git a/swh/scrubber/cli.py b/swh/scrubber/cli.py index e27922821122a7f35bfe1319b4df82af949f217f..ca2fafe6df82f21c025142bf760bcbb6a81c652f 100644 --- a/swh/scrubber/cli.py +++ b/swh/scrubber/cli.py @@ -387,7 +387,6 @@ def scrubber_check_stats(ctx, name: str, config_id: int, json_format: bool): stats = db.config_get_stats(config_id) if json_format: - stats["config"] = asdict(stats["config"]) stats["config"]["object_type"] = stats["config"]["object_type"].name.lower() click.echo(dumps(stats, indent=2)) diff --git a/swh/scrubber/tests/test_cli.py b/swh/scrubber/tests/test_cli.py index 53f9796f55f6b6dc5d4896b9d66000b9e3f94a05..381f7d18207fb5af05ccb6e258c4f3a7d29d7a2a 100644 --- a/swh/scrubber/tests/test_cli.py +++ b/swh/scrubber/tests/test_cli.py @@ -487,7 +487,6 @@ def test_check_stats(mocker, scrubber_db, swh_storage): assert result.exit_code == 0, result.output for otype in ("snapshot", "revision", "release"): - result = invoke( scrubber_db, ["check", "stats", "--json", f"cfg_{otype}"], @@ -701,7 +700,7 @@ def test_check_journal( assert journal_checker.method_calls == [call.run()] -def test_locate_origins(mocker, scrubber_db, swh_storage): +def test_locate_origins(mocker, scrubber_db, swh_storage, naive_graph_client): origin_locator = MagicMock() OriginLocator = mocker.patch( "swh.scrubber.origin_locator.OriginLocator", return_value=origin_locator @@ -709,6 +708,11 @@ def test_locate_origins(mocker, scrubber_db, swh_storage): get_scrubber_db = mocker.patch( "swh.scrubber.get_scrubber_db", return_value=scrubber_db ) + mocker.patch( + "swh.graph.http_client.RemoteGraphClient", + return_value=naive_graph_client, + ) + result = invoke(scrubber_db, ["locate"], storage=swh_storage) assert result.exit_code == 0, result.output assert result.output == ""