From c6b7794510b5179f6ea574019df79a040e3c5f42 Mon Sep 17 00:00:00 2001 From: CaselIT Date: Fri, 27 Dec 2019 10:33:00 +0100 Subject: [PATCH] remove unnecessary test function --- alembic/testing/__init__.py | 1 - alembic/testing/util.py | 10 ---------- alembic/util/compat.py | 1 - tests/test_command.py | 17 +++++++++++------ 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/alembic/testing/__init__.py b/alembic/testing/__init__.py index 57c97b50..f1884a97 100644 --- a/alembic/testing/__init__.py +++ b/alembic/testing/__init__.py @@ -19,4 +19,3 @@ from .assertions import ne_ # noqa from .fixture_functions import combinations # noqa from .fixture_functions import fixture # noqa from .fixtures import TestBase # noqa -from .util import ospath # noqa diff --git a/alembic/testing/util.py b/alembic/testing/util.py index 032e875f..87dfcd58 100644 --- a/alembic/testing/util.py +++ b/alembic/testing/util.py @@ -4,8 +4,6 @@ # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -from os.path import normpath -from ..util.compat import win def flag_combinations(*combinations): @@ -80,11 +78,3 @@ def metadata_fixture(ddl="function"): return fixture_functions.fixture(scope=ddl)(run_ddl) return decorate - - -def ospath(linux_path): - """Takes a linux path with / and transforms it to the correct os path. - This is mainly to support windows \\""" - if win: - return normpath(linux_path) - return linux_path diff --git a/alembic/util/compat.py b/alembic/util/compat.py index 543113f4..78a93fe9 100644 --- a/alembic/util/compat.py +++ b/alembic/util/compat.py @@ -8,7 +8,6 @@ py2k = sys.version_info.major < 3 py3k = sys.version_info.major >= 3 py35 = sys.version_info >= (3, 5) py36 = sys.version_info >= (3, 6) -win = "win" in sys.platform ArgSpec = collections.namedtuple( diff --git a/tests/test_command.py b/tests/test_command.py index b96bb40c..b866d63b 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -16,7 +16,6 @@ from alembic.testing import assert_raises from alembic.testing import assert_raises_message from alembic.testing import eq_ from alembic.testing import mock -from alembic.testing import ospath from alembic.testing.env import _get_staging_directory from alembic.testing.env import _no_sql_testing_config from alembic.testing.env import _sqlite_file_db @@ -886,7 +885,7 @@ class EditTest(TestBase): command.stamp(self.cfg, "base") def test_edit_head(self): - expected_call_arg = ospath( + expected_call_arg = os.path.normpath( "%s/scripts/versions/%s_revision_c.py" % (EditTest.cfg.config_args["here"], EditTest.c,) ) @@ -896,7 +895,7 @@ class EditTest(TestBase): edit.assert_called_with(expected_call_arg) def test_edit_b(self): - expected_call_arg = ospath( + expected_call_arg = os.path.normpath( "%s/scripts/versions/%s_revision_b.py" % (EditTest.cfg.config_args["here"], EditTest.b,) ) @@ -935,7 +934,7 @@ class EditTest(TestBase): ) def test_edit_current(self): - expected_call_arg = ospath( + expected_call_arg = os.path.normpath( "%s/scripts/versions/%s_revision_b.py" % (EditTest.cfg.config_args["here"], EditTest.b,) ) @@ -1103,7 +1102,10 @@ class CommandLineTest(TestBase): "alembic.command.ScriptDirectory" ): command.init(self.cfg, directory="foobar") - eq_(makedirs.mock_calls, [mock.call(ospath("foobar/versions"))]) + eq_( + makedirs.mock_calls, + [mock.call(os.path.normpath("foobar/versions"))], + ) def test_init_file_doesnt_exist(self): def access_(path, mode): @@ -1120,7 +1122,10 @@ class CommandLineTest(TestBase): command.init(self.cfg, directory="foobar") eq_( makedirs.mock_calls, - [mock.call("foobar"), mock.call(ospath("foobar/versions"))], + [ + mock.call("foobar"), + mock.call(os.path.normpath("foobar/versions")), + ], ) def test_init_w_package(self): -- 2.47.2