commit:     bc1c06b215faefb5e78238d70fd9d72312a42640
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  1 14:42:14 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Apr  1 14:44:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc1c06b2

dev-python/alembic: Backport pytest-8 fix

Closes: https://bugs.gentoo.org/928355
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/alembic/alembic-1.13.1.ebuild           |  5 ++
 .../alembic/files/alembic-1.13.1-pytest-8.patch    | 68 ++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/dev-python/alembic/alembic-1.13.1.ebuild 
b/dev-python/alembic/alembic-1.13.1.ebuild
index d30bacd5aaea..e8a5a9d46409 100644
--- a/dev-python/alembic/alembic-1.13.1.ebuild
+++ b/dev-python/alembic/alembic-1.13.1.ebuild
@@ -34,6 +34,11 @@ BDEPEND="
 EPYTEST_XDIST=1
 distutils_enable_tests pytest
 
+PATCHES=(
+       # 
https://github.com/sqlalchemy/alembic/commit/6bdb9043868d4bd04ebe3fe8a4991735d5f87ed3
+       "${FILESDIR}/${P}-pytest-8.patch"
+)
+
 python_test() {
        local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
        # setup.cfg contains -p no:warnings in addopts which triggers

diff --git a/dev-python/alembic/files/alembic-1.13.1-pytest-8.patch 
b/dev-python/alembic/files/alembic-1.13.1-pytest-8.patch
new file mode 100644
index 000000000000..a681645e02ec
--- /dev/null
+++ b/dev-python/alembic/files/alembic-1.13.1-pytest-8.patch
@@ -0,0 +1,68 @@
+From 6bdb9043868d4bd04ebe3fe8a4991735d5f87ed3 Mon Sep 17 00:00:00 2001
+From: Mike Bayer <[email protected]>
+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 c665f95..04a624a 100644
+--- a/tests/test_command.py
++++ b/tests/test_command.py
+@@ -64,7 +64,7 @@ class HistoryTest(_BufMixin, TestBase):
+     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 @@ finally:
+ 
+ 
+ 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 @@ class CommandLineTest(TestBase):
+         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
+-- 
+2.44.0
+

Reply via email to