From f1d0d3817f175e18f02760e1de63ef786dacc9bc Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 20 Sep 2025 18:31:25 -0400 Subject: [PATCH] remove _py3k suffixes from test files on the theme of 2.0/2.1 are relatively similar right now, do some more cleanup removing the py3k suffixes that we dont need anymore. I'm not sure that the logic that would search for these suffixes is even present anymore and I would guess we removed it when we removed py2k support. However, I am planning on possibly bringing it back for some of the py314 stuff, so I still want to be able to do suffix stuff. that will be for another patch. Change-Id: I929e6edd922f8d5f943acce77191fb1e3035b42c (cherry picked from commit fb3243475e208673d98c6a543cf16169f7f5f42d) --- test/base/test_misc_py3k.py | 17 ----------------- test/base/test_typing_utils.py | 18 ++++++++++++++++-- ...{test_async_pg_py3k.py => test_async_pg.py} | 0 .../{test_engine_py3k.py => test_engine.py} | 0 .../{test_scoping_py3k.py => test_scoping.py} | 2 +- .../{test_session_py3k.py => test_session.py} | 2 +- ...dataclasses_py3k.py => test_dataclasses.py} | 0 7 files changed, 18 insertions(+), 21 deletions(-) delete mode 100644 test/base/test_misc_py3k.py rename test/dialect/postgresql/{test_async_pg_py3k.py => test_async_pg.py} (100%) rename test/ext/asyncio/{test_engine_py3k.py => test_engine.py} (100%) rename test/ext/asyncio/{test_scoping_py3k.py => test_scoping.py} (98%) rename test/ext/asyncio/{test_session_py3k.py => test_session.py} (99%) rename test/orm/{test_dataclasses_py3k.py => test_dataclasses.py} (100%) diff --git a/test/base/test_misc_py3k.py b/test/base/test_misc_py3k.py deleted file mode 100644 index 99dbe2aef2..0000000000 --- a/test/base/test_misc_py3k.py +++ /dev/null @@ -1,17 +0,0 @@ -import operator -from typing import cast - -from sqlalchemy import Column -from sqlalchemy.testing import eq_ -from sqlalchemy.testing import fixtures - - -class TestGenerics(fixtures.TestBase): - def test_traversible_is_generic(self): - """test #6759""" - col = Column[int] - - # looked in the source for typing._GenericAlias. - # col.__origin__ is Column, but it's not public API. - # __reduce__ could change too but seems good enough for now - eq_(cast(object, col).__reduce__(), (operator.getitem, (Column, int))) diff --git a/test/base/test_typing_utils.py b/test/base/test_typing_utils.py index 51f5e13c41..58ad10fa95 100644 --- a/test/base/test_typing_utils.py +++ b/test/base/test_typing_utils.py @@ -1,14 +1,17 @@ # NOTE: typing implementation is full of heuristic so unit test it to avoid # unexpected breakages. +import operator import typing +from typing import cast import typing_extensions +from sqlalchemy import Column +from sqlalchemy.testing import eq_ from sqlalchemy.testing import fixtures +from sqlalchemy.testing import is_ from sqlalchemy.testing import requires -from sqlalchemy.testing.assertions import eq_ -from sqlalchemy.testing.assertions import is_ from sqlalchemy.util import py310 from sqlalchemy.util import py312 from sqlalchemy.util import py314 @@ -246,6 +249,17 @@ def exec_code(code: str, *vars: str) -> typing.Any: return [scope[name] for name in vars] +class TestGenerics(fixtures.TestBase): + def test_traversible_is_generic(self): + """test #6759""" + col = Column[int] + + # looked in the source for typing._GenericAlias. + # col.__origin__ is Column, but it's not public API. + # __reduce__ could change too but seems good enough for now + eq_(cast(object, col).__reduce__(), (operator.getitem, (Column, int))) + + class TestTestingThings(fixtures.TestBase): def test_unions_are_the_same(self): # the point of this test is to reduce the cases to test since diff --git a/test/dialect/postgresql/test_async_pg_py3k.py b/test/dialect/postgresql/test_async_pg.py similarity index 100% rename from test/dialect/postgresql/test_async_pg_py3k.py rename to test/dialect/postgresql/test_async_pg.py diff --git a/test/ext/asyncio/test_engine_py3k.py b/test/ext/asyncio/test_engine.py similarity index 100% rename from test/ext/asyncio/test_engine_py3k.py rename to test/ext/asyncio/test_engine.py diff --git a/test/ext/asyncio/test_scoping_py3k.py b/test/ext/asyncio/test_scoping.py similarity index 98% rename from test/ext/asyncio/test_scoping_py3k.py rename to test/ext/asyncio/test_scoping.py index caba1c6600..de00108bc4 100644 --- a/test/ext/asyncio/test_scoping_py3k.py +++ b/test/ext/asyncio/test_scoping.py @@ -7,7 +7,7 @@ from sqlalchemy.orm import sessionmaker from sqlalchemy.testing import async_test from sqlalchemy.testing import eq_ from sqlalchemy.testing import is_ -from .test_session_py3k import AsyncFixture +from .test_session import AsyncFixture class AsyncScopedSessionTest(AsyncFixture): diff --git a/test/ext/asyncio/test_session_py3k.py b/test/ext/asyncio/test_session.py similarity index 99% rename from test/ext/asyncio/test_session_py3k.py rename to test/ext/asyncio/test_session.py index 5f9bf2e089..dedbc7928b 100644 --- a/test/ext/asyncio/test_session_py3k.py +++ b/test/ext/asyncio/test_session.py @@ -48,7 +48,7 @@ from sqlalchemy.testing.assertions import not_in from sqlalchemy.testing.entities import ComparableEntity from sqlalchemy.testing.provision import normalize_sequence from sqlalchemy.testing.schema import Column -from .test_engine_py3k import AsyncFixture as _AsyncFixture +from .test_engine import AsyncFixture as _AsyncFixture from ...orm import _fixtures diff --git a/test/orm/test_dataclasses_py3k.py b/test/orm/test_dataclasses.py similarity index 100% rename from test/orm/test_dataclasses_py3k.py rename to test/orm/test_dataclasses.py -- 2.47.3