summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-08-25 17:26:49 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-08-25 17:26:49 +0000
commitf5583d42ed63c813f75545fab657198993e9e248 (patch)
treea1eb9ec52a88b5c8e5312474f2803ef2774f3e8b /tests
parent0876dca683d326474e2a6b1388e675ed97f286e0 (diff)
parente80d1d2299f69e1f4a4e91af70d1244a32c39c65 (diff)
downloadalembic-f5583d42ed63c813f75545fab657198993e9e248.tar.gz
Merge "remove dependency on pkg_resources"
Diffstat (limited to 'tests')
-rw-r--r--tests/test_post_write.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test_post_write.py b/tests/test_post_write.py
index 18c1d82..82a9174 100644
--- a/tests/test_post_write.py
+++ b/tests/test_post_write.py
@@ -133,17 +133,23 @@ class RunHookTest(TestBase):
self, input_config, expected_additional_arguments_fn, cwd=None
):
self.cfg = _no_sql_testing_config(directives=input_config)
- impl = mock.Mock(attrs=("foo", "bar"), module_name="black_module")
- entrypoints = mock.Mock(return_value=iter([impl]))
+
+ class MocksCantName:
+ name = "black"
+ attr = "bar"
+ module = "black_module.foo"
+
+ importlib_metadata_get = mock.Mock(return_value=iter([MocksCantName]))
with mock.patch(
- "pkg_resources.iter_entry_points", entrypoints
+ "alembic.util.compat.importlib_metadata_get",
+ importlib_metadata_get,
), mock.patch(
"alembic.script.write_hooks.subprocess"
) as mock_subprocess:
rev = command.revision(self.cfg, message="x")
- eq_(entrypoints.mock_calls, [mock.call("console_scripts", "black")])
+ eq_(importlib_metadata_get.mock_calls, [mock.call("console_scripts")])
eq_(
mock_subprocess.mock_calls,
[
@@ -151,7 +157,7 @@ class RunHookTest(TestBase):
[
sys.executable,
"-c",
- "import black_module; black_module.foo.bar()",
+ "import black_module.foo; black_module.foo.bar()",
]
+ expected_additional_arguments_fn(rev.path),
cwd=cwd,