This PR includes several small refactorings and style fixes aimed at improving code cleanliness, primarily within the test suite and tooling.
Key changes:
* Removed assignments to unused variables in various test files (`test_dialect.py`, `test_reflection.py`, `test_select.py`).
* Removed an unused variable in the pytest plugin (`pytestplugin.py`).
* Removed an unused variable in the topological sort utility (`topological.py`).
* Fixed a minor style issue (removed an extra blank line) in the `cython_imports.py` script.
Closes: #12539
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12539
Pull-request-sha:
837c1e6cb17f0ff31444d5161329c318b52e48e7
Change-Id: Ifa37fb956bc3cacd31967f08bdaa4254e16911c2
for test_class in test_classes:
# transfer legacy __backend__ and __sparse_backend__ symbols
# to be markers
- add_markers = set()
if getattr(test_class.cls, "__backend__", False) or getattr(
test_class.cls, "__only_on__", False
):
t.c[name].in_(["some name", "some other_name"])
)
- row = connection.execute(stmt).first()
+ connection.execute(stmt).first()
@testing.fixture
def multirow_fixture(self, metadata, connection):
f"current server capabilities does not support "
f".*RETURNING when executemany is used",
):
- result = connection.execute(
+ connection.execute(
stmt,
[
{id_param_name: 1, "data": "d1"},
is_true(isinstance(res, dict))
else:
with expect_raises(NotImplementedError):
- res = insp.get_table_options(name)
+ insp.get_table_options(name)
@quote_fixtures
@testing.requires.view_column_reflection
is_true(isinstance(res, dict))
else:
with expect_raises(NotImplementedError):
- res = insp.get_table_options("users", schema=schema)
+ insp.get_table_options("users", schema=schema)
@testing.combinations((True, testing.requires.schemas), False)
def test_multi_get_table_options(self, use_schema):
eq_(res, exp)
else:
with expect_raises(NotImplementedError):
- res = insp.get_multi_table_options()
+ insp.get_multi_table_options()
@testing.fixture
def get_multi_exp(self, connection):
)
def test_autoincrement_with_identity(self, connection):
- res = connection.execute(self.tables.tbl.insert(), {"desc": "row"})
+ connection.execute(self.tables.tbl.insert(), {"desc": "row"})
res = connection.execute(self.tables.tbl.select()).first()
eq_(res, (1, "row"))
todo.remove(node)
break
else:
- node = stack.pop()
+ stack.pop()
return output
from pathlib import Path
import re
-
from sqlalchemy.util.tool_support import code_writer_cmd
sa_path = Path(__file__).parent.parent / "lib/sqlalchemy"