From dc79e4bb11effd79dddf4464b0d6a287ad6c7a52 Mon Sep 17 00:00:00 2001
From: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date: Tue, 30 Jan 2024 18:26:13 +0100
Subject: [PATCH] Update for pytest-postgresql >= 5

---
 conftest.py                          | 1 -
 requirements-swh.txt                 | 4 ++--
 requirements-test.txt                | 2 +-
 swh/scrubber/tests/conftest.py       | 2 +-
 swh/scrubber/tests/test_migration.py | 2 +-
 5 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/conftest.py b/conftest.py
index 706148c..8391a78 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,5 +1,4 @@
 pytest_plugins = [
     "swh.storage.pytest_plugin",
-    "swh.core.db.pytest_plugin",
     "swh.graph.pytest_plugin",
 ]
diff --git a/requirements-swh.txt b/requirements-swh.txt
index cbdd63d..3f183bd 100644
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -1,6 +1,6 @@
 # Add here internal Software Heritage dependencies, one per line.
-swh.core[http] >= 0.3  # [http] is required by swh.core.pytest_plugin
+swh.core[http] >= 3.0.0
 swh.loader.git >= 1.4.0
 swh.model >= 5.0.0
-swh.storage >= 1.12.0
+swh.storage >= 2.0.0
 swh.journal >= 1.3.0
diff --git a/requirements-test.txt b/requirements-test.txt
index 4cd2c05..486a066 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -2,5 +2,5 @@ msgpack
 pytest
 pytest-mock
 pyyaml
-swh.core[testing]
+swh.core[testing] >= 3.0.0
 swh.graph
diff --git a/swh/scrubber/tests/conftest.py b/swh/scrubber/tests/conftest.py
index c8997fb..56bf2c8 100644
--- a/swh/scrubber/tests/conftest.py
+++ b/swh/scrubber/tests/conftest.py
@@ -83,7 +83,7 @@ def datastore():
 
 @pytest.fixture
 def scrubber_db(postgresql_scrubber):
-    db = ScrubberDb(postgresql_scrubber)
+    db = ScrubberDb.connect(postgresql_scrubber.info.dsn)
     with db.conn.cursor() as cur:
         cur.execute("TRUNCATE TABLE corrupt_object")
         cur.execute("TRUNCATE TABLE datastore CASCADE")
diff --git a/swh/scrubber/tests/test_migration.py b/swh/scrubber/tests/test_migration.py
index 895f620..04ff9ad 100644
--- a/swh/scrubber/tests/test_migration.py
+++ b/swh/scrubber/tests/test_migration.py
@@ -88,7 +88,7 @@ def test_upgrade_6_to_7(
     assert swh_db_version(conninfo) == 7
 
     tmap = {otype.name.lower(): otype.value for otype in ObjectType}
-    db = ScrubberDb(postgresql)
+    db = ScrubberDb.connect(postgresql.info.dsn)
 
     # corrupt objects
     corrupt_objects = list(db.corrupt_object_iter())
-- 
GitLab