commit:     641ddb19001069f92660b78b8877805fe23680d7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 29 14:43:52 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jan 29 14:53:30 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=641ddb19

dev-python/sybil: Add a fix for pytest-8

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

 dev-python/sybil/files/sybil-6.0.2-pytest-8.patch  | 40 ++++++++++++++++++++++
 .../{sybil-6.0.2.ebuild => sybil-6.0.2-r1.ebuild}  | 12 ++++++-
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/dev-python/sybil/files/sybil-6.0.2-pytest-8.patch 
b/dev-python/sybil/files/sybil-6.0.2-pytest-8.patch
new file mode 100644
index 000000000000..2447289c0266
--- /dev/null
+++ b/dev-python/sybil/files/sybil-6.0.2-pytest-8.patch
@@ -0,0 +1,40 @@
+From d7428b4cfe5f817037030d025028bf09fd7992ee Mon Sep 17 00:00:00 2001
+From: Adam Dangoor <adamdang...@gmail.com>
+Date: Mon, 29 Jan 2024 11:29:16 +0000
+Subject: [PATCH] Add fixes for Pytest 8.0.0
+
+---
+ CHANGELOG.rst               |  5 +++++
+ sybil/integration/pytest.py | 17 +++++++++++++----
+ 2 files changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/sybil/integration/pytest.py b/sybil/integration/pytest.py
+index 8ce6c72..cad311d 100644
+--- a/sybil/integration/pytest.py
++++ b/sybil/integration/pytest.py
+@@ -53,12 +53,21 @@ def __init__(self, parent, sybil, example: Example) -> 
None:
+     def request_fixtures(self, names):
+         # pytest fixtures dance:
+         fm = self.session._fixturemanager
+-        closure = fm.getfixtureclosure(names, self)
+-        initialnames, names_closure, arg2fixturedefs = closure
+-        fixtureinfo = FuncFixtureInfo(names, initialnames, names_closure, 
arg2fixturedefs)
++        if PYTEST_VERSION >= (8, 0, 0):
++            closure = fm.getfixtureclosure(initialnames=names, 
parentnode=self, ignore_args=set())
++            names_closure, arg2fixturedefs = closure
++            fixtureinfo = FuncFixtureInfo(argnames=names, initialnames=names, 
names_closure=names_closure, name2fixturedefs=arg2fixturedefs)
++        else:
++            closure = fm.getfixtureclosure(names, self)
++            initialnames, names_closure, arg2fixturedefs = closure
++            fixtureinfo = FuncFixtureInfo(names, initialnames, names_closure, 
arg2fixturedefs)
+         self._fixtureinfo = fixtureinfo
+         self.funcargs = {}
+-        self._request = fixtures.FixtureRequest(self, _ispytest=True)
++        if PYTEST_VERSION >= (8, 0, 0):
++            self._request = fixtures.TopRequest(pyfuncitem=self, 
_ispytest=True)
++            self.fixturenames = names_closure
++        else:
++            self._request = fixtures.FixtureRequest(self, _ispytest=True)
+ 
+     def reportinfo(self) -> Tuple[Union["os.PathLike[str]", str], 
Optional[int], str]:
+         info = '%s line=%i column=%i' % (

diff --git a/dev-python/sybil/sybil-6.0.2.ebuild 
b/dev-python/sybil/sybil-6.0.2-r1.ebuild
similarity index 77%
rename from dev-python/sybil/sybil-6.0.2.ebuild
rename to dev-python/sybil/sybil-6.0.2-r1.ebuild
index 27065ab0f6bb..0a280c114202 100644
--- a/dev-python/sybil/sybil-6.0.2.ebuild
+++ b/dev-python/sybil/sybil-6.0.2-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2019-2023 Gentoo Authors
+# Copyright 2019-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -32,3 +32,13 @@ BDEPEND="
 "
 
 distutils_enable_tests pytest
+
+PATCHES=(
+       # https://github.com/simplistix/sybil/pull/108
+       "${FILESDIR}/${P}-pytest-8.patch"
+)
+
+python_test() {
+       local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+       epytest
+}

Reply via email to