]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
use @classmethod per pytest guidance
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 Jun 2026 15:36:02 +0000 (11:36 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 Jun 2026 22:57:55 +0000 (18:57 -0400)
commitef4e938f8d681ba5e8959767e7b5f90207d60fbd
tree0f5f61116fd56664efe27aa9c69d1985fc77d78d
parent61e74ff61dae24e4c4eec528e36a71c10bf15294
use @classmethod per pytest guidance

Fixed class-scoped pytest fixtures that were defined as instance methods
using ``self``, which is deprecated as of pytest 9.1 and will be removed in
pytest 10. Fixtures are now decorated with a compatibility ``@classmethod``
decorator and use ``cls`` as the first parameter.

In the 2.0 branch, the approach is considerably more complicated
as python 3.7, 3.8, 3.9 doesn't work with this pattern; since the
warning appears in pytest 9.1 and not 9.0, which itself is only
python 3.10+, we use a conditional classmethod wrapper.

in the 2.1 branch, we can just use straight `@classmethod`.

Fixes: #13392
Change-Id: I866de54e22569c9d55eb97dce165670994ec4a57
(cherry picked from commit cd7eeb34d3741c94b2f9476aec7f3386132a71d5)
doc/build/changelog/unreleased_20/13392.rst [new file with mode: 0644]
lib/sqlalchemy/testing/__init__.py
lib/sqlalchemy/testing/config.py
lib/sqlalchemy/testing/fixtures/mypy.py
lib/sqlalchemy/testing/fixtures/orm.py
lib/sqlalchemy/testing/fixtures/sql.py
lib/sqlalchemy/testing/plugin/plugin_base.py
lib/sqlalchemy/testing/plugin/pytestplugin.py
test/aaa_profiling/test_misc.py
test/ext/test_mutable.py