From 0b3663ef98271549dae6413eab95f925877cbe5d67559bc79285912c3bc922e6 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Mon, 20 May 2024 18:21:40 +0000 Subject: [PATCH] Accepting request 1174864 from home:mcalabkova:branches:devel:languages:python:pytest - Add pytest8.patch to fix the tests with the new pytest OBS-URL: https://build.opensuse.org/request/show/1174864 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-alembic?expand=0&rev=160 --- pytest8.patch | 65 ++++++++++++++++++++++++++++++++++++++++++ python-alembic.changes | 5 ++++ python-alembic.spec | 6 ++-- 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 pytest8.patch diff --git a/pytest8.patch b/pytest8.patch new file mode 100644 index 0000000..61d0087 --- /dev/null +++ b/pytest8.patch @@ -0,0 +1,65 @@ +From 6bdb9043868d4bd04ebe3fe8a4991735d5f87ed3 Mon Sep 17 00:00:00 2001 +From: Mike Bayer +Date: Sun, 3 Mar 2024 23:11:50 -0500 +Subject: [PATCH] use SQLAlchemy's xdist methods + +Fixes to support pytest 8.1 for the test suite. + +the use of teardown() was based on pytest's nose +compat, which is removed. their xdist style tests use the name +"setup_method()" and "teardown_method()" now. + +We have SQLAlchemy's pytestplugin in use which uses pytest fixtures +to invoke our own xdist style setUp and tearDown methods, which we +are already using here, so use those for this one test. + +Fixes: #1435 +Change-Id: I4c49e81fca6bfa957594714009531fe12691ace5 +--- + docs/build/unreleased/1435.rst | 5 +++++ + tests/test_command.py | 15 +++++++-------- + tox.ini | 2 +- + 3 files changed, 13 insertions(+), 9 deletions(-) + create mode 100644 docs/build/unreleased/1435.rst + +diff --git a/tests/test_command.py b/tests/test_command.py +index c665f955..04a624ad 100644 +--- a/tests/test_command.py ++++ b/tests/test_command.py +@@ -64,7 +64,7 @@ def setup_class(cls): + def teardown_class(cls): + clear_staging_env() + +- def teardown(self): ++ def tearDown(self): + self.cfg.set_main_option("revision_environment", "false") + + @classmethod +@@ -206,13 +206,12 @@ def test_history_indicate_current(self): + + + class RevisionEnvironmentTest(_BufMixin, TestBase): +- @classmethod +- def setup(cls): +- cls.env = staging_env() +- cls.cfg = _sqlite_testing_config() +- cls._setup_env_file() ++ def setUp(self): ++ self.env = staging_env() ++ self.cfg = _sqlite_testing_config() ++ self._setup_env_file() + +- def teardown(self): ++ def tearDown(self): + self.cfg.set_main_option("revision_environment", "false") + clear_staging_env() + +@@ -1144,7 +1143,7 @@ def setup_class(cls): + cls.cfg = _sqlite_testing_config() + cls.a, cls.b, cls.c = three_rev_fixture(cls.cfg) + +- def teardown(self): ++ def tearDown(self): + os.environ.pop("ALEMBIC_CONFIG", None) + + @classmethod diff --git a/python-alembic.changes b/python-alembic.changes index 1fcd072..e477130 100644 --- a/python-alembic.changes +++ b/python-alembic.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri May 17 13:09:48 UTC 2024 - Markéta Machová + +- Add pytest8.patch to fix the tests with the new pytest + ------------------------------------------------------------------- Wed Dec 27 09:35:46 UTC 2023 - Dirk Müller diff --git a/python-alembic.spec b/python-alembic.spec index 11ce266..b0adb63 100644 --- a/python-alembic.spec +++ b/python-alembic.spec @@ -1,7 +1,7 @@ # # spec file for package python-alembic # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,6 +24,8 @@ Summary: A database migration tool for SQLAlchemy License: MIT URL: https://github.com/sqlalchemy/alembic Source0: https://files.pythonhosted.org/packages/source/a/alembic/alembic-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/sqlalchemy/alembic/commit/6bdb9043868d4bd04ebe3fe8a4991735d5f87ed3 use SQLAlchemy's xdist methods +Patch: pytest8.patch BuildRequires: %{python_module Mako} BuildRequires: %{python_module SQLAlchemy >= 2.0.0} BuildRequires: %{python_module backports.zoneinfo if %python-base < 3.9} @@ -42,7 +44,7 @@ Requires: python-Mako Requires: python-SQLAlchemy >= 2.0.0 Requires: python-typing-extensions >= 4 Requires(post): update-alternatives -Requires(postun):update-alternatives +Requires(postun): update-alternatives BuildArch: noarch %if 0%{?python_version_nodots} < 39 Requires: python-importlib-metadata