summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-03-15 15:03:33 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-03-15 15:09:08 +0100
commit45ebd90c186558556f2fe28ff2eb0cd424768b55 (patch)
treeafab91b76f2a0bdddc203080247e2e8e4c05e8c5
parentbaea210c04fd9e36340379b580331c9aeea6378b (diff)
downloadguix-45ebd90c186558556f2fe28ff2eb0cd424768b55.tar.gz
gnu: python-alembic: Update to 1.4.1.
* gnu/packages/patches/python-alembic-exceptions-cause.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/databases.scm (python-alembic): Update to 1.4.1.
[source](patches): New field.
[arguments]: New field, override check phase.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/databases.scm10
-rw-r--r--gnu/packages/patches/python-alembic-exceptions-cause.patch69
3 files changed, 78 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 29ca54a0ca..3be54b2627 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1320,6 +1320,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3.8-search-paths.patch		\
   %D%/packages/patches/python-3.8-fix-tests.patch		\
   %D%/packages/patches/python-CVE-2018-14647.patch		\
+  %D%/packages/patches/python-alembic-exceptions-cause.patch	\
   %D%/packages/patches/python-axolotl-AES-fix.patch		\
   %D%/packages/patches/python-cairocffi-dlopen-path.patch	\
   %D%/packages/patches/python-cffi-x87-stack-clean.patch	\
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index a4854580e8..be4db42332 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -2613,15 +2613,21 @@ You might also want to install the following optional dependencies:
 (define-public python-alembic
   (package
     (name "python-alembic")
-    (version "1.0.11")
+    (version "1.4.1")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "alembic" version))
+       (patches (search-patches "python-alembic-exceptions-cause.patch"))
        (sha256
         (base32
-         "1k5hag0vahd5vrf9abx8fdj2whrwaw2iq2yp736mmxnbsn5xkdyd"))))
+         "0a4hzn76csgbf1px4f5vfm256byvjrqkgi9869nkcjrwjn35c6kr"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda _
+                      (invoke "pytest" "-vv"))))))
     (native-inputs
      `(("python-mock" ,python-mock)
        ("python-pytest-cov" ,python-pytest-cov)))
diff --git a/gnu/packages/patches/python-alembic-exceptions-cause.patch b/gnu/packages/patches/python-alembic-exceptions-cause.patch
new file mode 100644
index 0000000000..b9844e5ad0
--- /dev/null
+++ b/gnu/packages/patches/python-alembic-exceptions-cause.patch
@@ -0,0 +1,69 @@
+Fix a test failure with newer versions of SQLalchemy due to missing
+"causes" for some exceptions.
+
+diff --git a/alembic/operations/ops.py b/alembic/operations/ops.py
+index 5ec2762..7129472 100644
+--- a/alembic/operations/ops.py
++++ b/alembic/operations/ops.py
+@@ -108,6 +108,7 @@ def from_constraint(cls, constraint):
+             "primary_key_constraint": "primary",
+             "check_constraint": "check",
+             "column_check_constraint": "check",
++            "table_or_column_check_constraint": "check",
+         }
+ 
+         constraint_table = sqla_compat._table_for_constraint(constraint)
+@@ -707,6 +708,7 @@ def batch_create_foreign_key(
+     "create_check_constraint", "batch_create_check_constraint"
+ )
+ @AddConstraintOp.register_add_constraint("check_constraint")
++@AddConstraintOp.register_add_constraint("table_or_column_check_constraint")
+ @AddConstraintOp.register_add_constraint("column_check_constraint")
+ class CreateCheckConstraintOp(AddConstraintOp):
+     """Represent a create check constraint operation."""
+diff --git a/alembic/testing/assertions.py b/alembic/testing/assertions.py
+index 3dc08f0..a78e5e8 100644
+--- a/alembic/testing/assertions.py
++++ b/alembic/testing/assertions.py
+@@ -2,10 +2,9 @@
+ 
+ import re
+ 
++from sqlalchemy import util
+ from sqlalchemy.engine import default
+ from sqlalchemy.testing.assertions import _expect_warnings
+-from sqlalchemy.testing.assertions import assert_raises  # noqa
+-from sqlalchemy.testing.assertions import assert_raises_message  # noqa
+ from sqlalchemy.testing.assertions import eq_  # noqa
+ from sqlalchemy.testing.assertions import is_  # noqa
+ from sqlalchemy.testing.assertions import is_false  # noqa
+@@ -17,6 +16,29 @@
+ from ..util.compat import py3k
+ 
+ 
++def assert_raises(except_cls, callable_, *args, **kw):
++    try:
++        callable_(*args, **kw)
++        success = False
++    except except_cls:
++        success = True
++
++    # assert outside the block so it works for AssertionError too !
++    assert success, "Callable did not raise an exception"
++
++
++def assert_raises_message(except_cls, msg, callable_, *args, **kwargs):
++    try:
++        callable_(*args, **kwargs)
++        assert False, "Callable did not raise an exception"
++    except except_cls as e:
++        assert re.search(msg, util.text_type(e), re.UNICODE), "%r !~ %s" % (
++            msg,
++            e,
++        )
++        print(util.text_type(e).encode("utf-8"))
++
++
+ def eq_ignore_whitespace(a, b, msg=None):
+     # sqlalchemy.testing.assertion has this function
+     # but not with the special "!U" detection part