summaryrefslogtreecommitdiff
path: root/tests/test_post_write.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2021-09-30 15:06:13 +0200
committerFederico Caselli <cfederico87@gmail.com>2021-09-30 18:31:34 +0200
commit8d166b17aa7b1c4ec058fa31e489a57b3a7f5cbf (patch)
tree47fc36c45c40f3dfcc7491b7a57219b345185b50 /tests/test_post_write.py
parentd95e15cac59dc449f712f51183462a8688a51086 (diff)
downloadalembic-8d166b17aa7b1c4ec058fa31e489a57b3a7f5cbf.tar.gz
Fix write hook issue in python < 3.9.
Adjust require of importlib_metadata also include py3.8. Fixes: #934 Change-Id: Id64163a0dc53226d62795d40190b6cec0aee522b
Diffstat (limited to 'tests/test_post_write.py')
-rw-r--r--tests/test_post_write.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/test_post_write.py b/tests/test_post_write.py
index 82a9174..a8bcd2f 100644
--- a/tests/test_post_write.py
+++ b/tests/test_post_write.py
@@ -134,12 +134,20 @@ class RunHookTest(TestBase):
):
self.cfg = _no_sql_testing_config(directives=input_config)
- class MocksCantName:
- name = "black"
- attr = "bar"
- module = "black_module.foo"
-
- importlib_metadata_get = mock.Mock(return_value=iter([MocksCantName]))
+ retVal = [
+ compat.EntryPoint(
+ name="black",
+ value="black.foo:patched_main",
+ group="console_scripts",
+ ),
+ compat.EntryPoint(
+ name="alembic",
+ value="alembic.config:main",
+ group="console_scripts",
+ ),
+ ]
+
+ importlib_metadata_get = mock.Mock(return_value=retVal)
with mock.patch(
"alembic.util.compat.importlib_metadata_get",
importlib_metadata_get,
@@ -157,7 +165,7 @@ class RunHookTest(TestBase):
[
sys.executable,
"-c",
- "import black_module.foo; black_module.foo.bar()",
+ "import black.foo; black.foo.patched_main()",
]
+ expected_additional_arguments_fn(rev.path),
cwd=cwd,