]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix(test): work around error with issubclass(collections.ablc.Callable)
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 7 May 2025 10:43:23 +0000 (12:43 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 5 Jul 2025 11:23:57 +0000 (13:23 +0200)
Reproduced only on Python 3.10

tests/test_adapt.py

index 764375715ba022c36b698ef50bc8bb63b87702b7..f80b0aacc86469514b053d98eabe7dbc3c6512fb 100644 (file)
@@ -448,7 +448,12 @@ def test_optimised_adapters():
         for n1 in dir(mod):
             if not isinstance((obj := getattr(mod, n1)), type):
                 continue
-            if not issubclass(obj, (Dumper, Loader)):
+            try:
+                if not issubclass(obj, (Dumper, Loader)):
+                    continue
+            except TypeError:
+                # On Python 3.10 'collections.abc.Callable' raises:
+                # TypeError: issubclass() arg 1 must be a class
                 continue
             c_adapters.pop(obj.__name__, None)