diff --git a/swh/storage/pytest_plugin.py b/swh/storage/pytest_plugin.py --- a/swh/storage/pytest_plugin.py +++ b/swh/storage/pytest_plugin.py @@ -24,19 +24,14 @@ @pytest.fixture -def swh_storage_backend_config(postgresql_proc, swh_storage_postgresql): +def swh_storage_backend_config(swh_storage_postgresql): """Basic pg storage configuration with no journal collaborator (to avoid pulling optional dependency on clients of this fixture) """ yield { "cls": "local", - "db": "postgresql://{user}@{host}:{port}/{dbname}".format( - host=postgresql_proc.host, - port=postgresql_proc.port, - user="postgres", - dbname="tests", - ), + "db": swh_storage_postgresql.dsn, "objstorage": {"cls": "memory", "args": {}}, "check_config": {"check_write": True}, } @@ -70,17 +65,17 @@ pg_port = proc_fixture.port pg_user = proc_fixture.user pg_options = proc_fixture.options - pg_db = db_name or config["dbname"] + pg_dbname = db_name or config["dbname"] with SwhDatabaseJanitor( pg_user, pg_host, pg_port, - pg_db, + pg_dbname, proc_fixture.version, dump_files=dump_files, ): connection = psycopg2.connect( - dbname=pg_db, + dbname=pg_dbname, user=pg_user, host=pg_host, port=pg_port, @@ -92,7 +87,7 @@ return postgresql_factory -swh_storage_postgresql = postgresql_fact("postgresql_proc") +swh_storage_postgresql = postgresql_fact("postgresql_proc", db_name="storage") # This version of the DatabaseJanitor implement a different setup/teardown