summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-04-21 12:39:08 -0400
committersqla-tester <sqla-tester@sqlalchemy.org>2022-04-21 12:39:08 -0400
commite539704aae92bee5d266b1e4e5cfe54b14d544f1 (patch)
treeae7e5d6839467726ffe3c2c799b36f558ed50dfb /tests
parentd770c1ebc596c58c2d010233457fe62ea04af509 (diff)
downloadalembic-e539704aae92bee5d266b1e4e5cfe54b14d544f1.tar.gz
Use `-> None` in script templates by default
<!-- Provide a general summary of your proposed changes in the Title field above --> ### Description When working together with `mypy` we have a problem with the default template. `mypy` raises errors on all migrations when used with https://mypy.readthedocs.io/en/stable/config_file.html#confval-disallow_untyped_defs So, there are several options: 1. Remove this flag for `[mypy-db.alembic.*]` in `mypy.ini`. This is not a very good idea, because custom code that might get written in this directory might be not fully typed. 2. Edit our own template. This is what we end up doing right now, but this requires some manual work and many users might miss it 3. Update the source! I think that this is harmless (because only python3.6+ is supported), but allows better type-checking ### Checklist Openning this as a draft for now. Will fix tests after I can see what is failing in the CI. Issue is also on its way! 🙂 <!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once) --> This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [ ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [x] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. Fixes https://github.com/sqlalchemy/alembic/issues/764 **Have a nice day!** Closes: #1012 Pull-request: https://github.com/sqlalchemy/alembic/pull/1012 Pull-request-sha: c1d17b202f414a97e6215cc2a513509462a9db09 Change-Id: Ib077157b5ebd697bf648644a954ed5a9a3b33080
Diffstat (limited to 'tests')
-rw-r--r--tests/test_script_production.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_script_production.py b/tests/test_script_production.py
index 2edae26..05167f0 100644
--- a/tests/test_script_production.py
+++ b/tests/test_script_production.py
@@ -618,7 +618,7 @@ def downgrade():
assert (
(
"""
-def upgrade():
+def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('test_table',
sa.Column('id', sa.Integer(), nullable=False),