summaryrefslogtreecommitdiff
path: root/test/aaa_profiling/test_memusage.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2023-02-28 11:05:48 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2023-02-28 11:50:54 -0500
commitda70478eb2eafe9c76b836217371e029c3c820e3 (patch)
tree96f7310c68fd659ab472832e45107095c70081f6 /test/aaa_profiling/test_memusage.py
parenta7f3dad6c93ab43a11521a2ecd240b5e023367fc (diff)
downloadsqlalchemy-da70478eb2eafe9c76b836217371e029c3c820e3.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 'test/aaa_profiling/test_memusage.py')
-rw-r--r--test/aaa_profiling/test_memusage.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py
index d30ccb3b8..9b2cb31be 100644
--- a/test/aaa_profiling/test_memusage.py
+++ b/test/aaa_profiling/test_memusage.py
@@ -6,6 +6,7 @@ import pickle
import weakref
import sqlalchemy as sa
+from sqlalchemy import and_
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import inspect
@@ -14,8 +15,12 @@ from sqlalchemy import MetaData
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy import testing
+from sqlalchemy import types
from sqlalchemy import Unicode
from sqlalchemy import util
+from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import postgresql
+from sqlalchemy.dialects import sqlite
from sqlalchemy.engine import result
from sqlalchemy.engine.processors import to_decimal_processor_factory
from sqlalchemy.orm import aliased
@@ -34,6 +39,7 @@ from sqlalchemy.orm import subqueryload
from sqlalchemy.orm.session import _sessions
from sqlalchemy.sql import column
from sqlalchemy.sql import util as sql_util
+from sqlalchemy.sql.util import visit_binary_product
from sqlalchemy.sql.visitors import cloned_traverse
from sqlalchemy.sql.visitors import replacement_traverse
from sqlalchemy.testing import engines
@@ -310,9 +316,6 @@ class MemUsageTest(EnsureZeroed):
"""test storage of bind processors, result processors
in dialect-wide registry."""
- from sqlalchemy.dialects import mysql, postgresql, sqlite
- from sqlalchemy import types
-
eng = engines.testing_engine()
for args in (
(types.Integer, {}),
@@ -1669,9 +1672,6 @@ class CycleTest(_fixtures.FixtureTest):
def test_visit_binary_product(self):
a, b, q, e, f, j, r = (column(chr_) for chr_ in "abqefjr")
- from sqlalchemy import and_, func
- from sqlalchemy.sql.util import visit_binary_product
-
expr = and_((a + b) == q + func.sum(e + f), j == r)
def visit(expr, left, right):