]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
repair py2k support
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 16 Jun 2021 17:39:03 +0000 (13:39 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 16 Jun 2021 17:39:03 +0000 (13:39 -0400)
the editor patch had some py3 isms as a result of us disabling
the python 2 tests in gerrit.   need to move forward w/ the py3k
or re-enable py2k

Change-Id: If47b0ebc105131fd3e7b8e6d76e0555da1484b8c

alembic/util/editor.py
tests/test_editor.py

index c27f0f36b2eaaa83352fc824050b6e1ccf06f607..51041489c8b702d2a85034424fb0d7723663880c 100644 (file)
@@ -5,6 +5,7 @@ from os.path import splitext
 from subprocess import check_call
 
 from .compat import is_posix
+from .compat import raise_
 from .exc import CommandError
 
 
@@ -27,7 +28,7 @@ def open_in_editor(filename, environ=None):
         editor = _find_editor(environ)
         check_call([editor, filename])
     except Exception as exc:
-        raise CommandError("Error executing editor (%s)" % (exc,)) from exc
+        raise_(CommandError("Error executing editor (%s)" % (exc,)), from_=exc)
 
 
 def _find_editor(environ=None):
index 0ec6f5f43f43523739b477959207631184c284f6..4a58b8fb4612cb8fce6cb6a63f80c51e34053c91 100644 (file)
@@ -1,21 +1,23 @@
 import os
 from os.path import join
-from unittest.mock import patch
 
 from alembic import util
 from alembic.testing import combinations
 from alembic.testing import expect_raises_message
+from alembic.testing import mock
 from alembic.testing.fixtures import TestBase
 
 
 class TestHelpers(TestBase):
     def common(self, cb, is_posix=True):
-        with patch("alembic.util.editor.check_call") as check_call, patch(
+        with mock.patch(
+            "alembic.util.editor.check_call"
+        ) as check_call, mock.patch(
             "alembic.util.editor.exists"
-        ) as exists, patch(
+        ) as exists, mock.patch(
             "alembic.util.editor.is_posix",
             new=is_posix,
-        ), patch(
+        ), mock.patch(
             "os.pathsep", new=":" if is_posix else ";"
         ):
             cb(check_call, exists)