diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-02-28 10:58:22 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-02-28 11:37:02 -0500 |
commit | 919297555f17efedcdcc7cc936204a1b86b804d3 (patch) | |
tree | 45f92ba2c4428a0f3ab99bda5cf9a6a8e662f8e8 /alembic/testing | |
parent | b53ec0004a08c40a25a4dbf047c51cd140971a9c (diff) | |
download | alembic-919297555f17efedcdcc7cc936204a1b86b804d3.tar.gz |
ensure single import per line
This adds the very small plugin flake8-import-single which
will prevent us from having an import with more than one symbol
on a line.
Flake8 by itself prevents this pattern with E401:
import collections, os, sys
However does not do anything with this:
from sqlalchemy import Column, text
Both statements have the same issues generating merge artifacts
as well as presenting a manual decision to be made. While
zimports generally cleans up such imports at the top level, we
don't enforce zimports / pre-commit use.
the plugin finds the same issue for imports that are inside of
test methods. We shouldn't usually have imports in test methods
so most of them here are moved to be top level.
The version is pinned at 0.1.5; the project seems to have no
activity since 2019, however there are three 0.1.6dev releases
on pypi which stopped in September 2019, they seem to be
experiments with packaging. The source for 0.1.5
is extremely simple and only reveals one method to flake8
(the run() method).
Change-Id: Icea894e43bad9c0b5d4feb5f49c6c666d6ea6aa1
Diffstat (limited to 'alembic/testing')
-rw-r--r-- | alembic/testing/env.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/alembic/testing/env.py b/alembic/testing/env.py index 3d42f1c..79a4980 100644 --- a/alembic/testing/env.py +++ b/alembic/testing/env.py @@ -7,6 +7,8 @@ from sqlalchemy.testing import config from sqlalchemy.testing import provision from . import util as testing_util +from .. import command +from .. import script from .. import util from ..script import Script from ..script import ScriptDirectory @@ -20,7 +22,6 @@ def _get_staging_directory(): def staging_env(create=True, template="generic", sourceless=False): - from alembic import command, script cfg = _testing_config() if create: |