diff options
author | CaselIT <cfederico87@gmail.com> | 2021-06-15 22:32:05 +0200 |
---|---|---|
committer | CaselIT <cfederico87@gmail.com> | 2021-06-15 23:38:07 +0200 |
commit | 7756b35e23ec11b64a1ac37afcb41dda3ca29913 (patch) | |
tree | a2c46870a195f22c7489bface5a890cf90acff5c /tests/test_command.py | |
parent | c0f0a3238fe1ec8029d66ad6ac518b60c78c36ed (diff) | |
download | alembic-7756b35e23ec11b64a1ac37afcb41dda3ca29913.tar.gz |
Revendor editor and make dateutil optional
Re-implemented the ``python-editor`` dependency as a small internal
function to avoid the need for external dependencies.
The implementation is based on the original
version in 7b91b325ff43a0e9235e0f15b57391fa92352626.
Make the ``python-dateutil`` library an optional dependency.
This library is only required if the ``timezone`` option
is used in the Alembic configuration.
An extra require named ``tz`` is available with
``pip install alembic[tz]`` to install it.
Fixes: #674
Fixes: #856
Change-Id: I07f17b2fea01e3a3d677ce95333fe3e8d8d438fd
Diffstat (limited to 'tests/test_command.py')
-rw-r--r-- | tests/test_command.py | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/tests/test_command.py b/tests/test_command.py index 4114be0..a477a1d 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -11,12 +11,10 @@ from sqlalchemy import text from alembic import __version__ from alembic import command from alembic import config -from alembic import testing from alembic import util from alembic.script import ScriptDirectory from alembic.testing import assert_raises from alembic.testing import assert_raises_message -from alembic.testing import config as testing_config from alembic.testing import eq_ from alembic.testing import is_false from alembic.testing import is_true @@ -924,7 +922,7 @@ class EditTest(TestBase): % (EditTest.cfg.config_args["here"], EditTest.c) ) - with mock.patch("alembic.util.edit") as edit: + with mock.patch("alembic.util.open_in_editor") as edit: command.edit(self.cfg, "head") edit.assert_called_with(expected_call_arg) @@ -934,22 +932,10 @@ class EditTest(TestBase): % (EditTest.cfg.config_args["here"], EditTest.b) ) - with mock.patch("alembic.util.edit") as edit: + with mock.patch("alembic.util.open_in_editor") as edit: command.edit(self.cfg, self.b[0:3]) edit.assert_called_with(expected_call_arg) - @testing_config.requirements.editor_installed - @testing.emits_python_deprecation_warning("the imp module is deprecated") - def test_edit_with_missing_editor(self): - with mock.patch("editor.edit") as edit_mock: - edit_mock.side_effect = OSError("file not found") - assert_raises_message( - util.CommandError, - "file not found", - util.edit, - "/not/a/file.txt", - ) - def test_edit_no_revs(self): assert_raises_message( util.CommandError, @@ -975,7 +961,7 @@ class EditTest(TestBase): ) command.stamp(self.cfg, self.b) - with mock.patch("alembic.util.edit") as edit: + with mock.patch("alembic.util.open_in_editor") as edit: command.edit(self.cfg, "current") edit.assert_called_with(expected_call_arg) |