]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test: allow running tests with old psycopg versions
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 7 May 2025 22:50:31 +0000 (00:50 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 7 May 2025 23:17:11 +0000 (01:17 +0200)
tests/types/test_hstore.py

index 954687e4f9ed9246a7c044ed4edbe41c9b2869c3..ece421cc54a51e3d049e5e30451fd8e1804d5632 100644 (file)
@@ -3,8 +3,14 @@ import pytest
 import psycopg
 from psycopg.pq import Format
 from psycopg.types import TypeInfo
-from psycopg.types.hstore import HstoreBinaryLoader, HstoreLoader
-from psycopg.types.hstore import _make_hstore_binary_dumper, register_hstore
+
+try:
+    from psycopg.types.hstore import HstoreBinaryLoader, HstoreLoader
+    from psycopg.types.hstore import _make_hstore_binary_dumper, register_hstore
+except ImportError:
+    # Allow to import the module without failing if psycopg is an old version
+    # (e.g. to run pool tests with an old psycopg)
+    pass
 
 pytestmark = pytest.mark.crdb_skip("hstore")