commit:     bf771b119c73f49614f9d1aedf1cc5480b79c303
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 24 16:47:14 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jan 24 16:51:31 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf771b11

dev-python/html5lib: Backport pytest-7.4 fix

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

 .../html5lib/files/html5lib-1.1-pytest6.patch      | 66 ++++++++++------------
 dev-python/html5lib/html5lib-1.1-r1.ebuild         |  7 ++-
 2 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/dev-python/html5lib/files/html5lib-1.1-pytest6.patch 
b/dev-python/html5lib/files/html5lib-1.1-pytest6.patch
index a511b40abeaa..d8df5f2cf2f6 100644
--- a/dev-python/html5lib/files/html5lib-1.1-pytest6.patch
+++ b/dev-python/html5lib/files/html5lib-1.1-pytest6.patch
@@ -1,41 +1,7 @@
 # https://github.com/html5lib/html5lib-python/pull/506
 # https://bugs.gentoo.org/754144
-From e6bd99e8f2497194ffd0a06c6954ebb28d7526bb Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <[email protected]>
-Date: Sat, 8 Aug 2020 13:39:22 +0200
-Subject: [PATCH] Use Node.from_parent() constructor to support pytest 6
 
-Add a wrapper not to break pytest 4 (needed for Python 2 support).
-
-    ============================= test session starts 
==============================
-    platform linux -- Python 3.9.0b5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
-    rootdir: /builddir/build/BUILD/html5lib-1.1, configfile: pytest.ini
-    plugins: expect-1.1.0
-    collected 0 items / 1 error
-
-    ==================================== ERRORS 
====================================
-    ________________________ ERROR collecting test session 
_________________________
-    /usr/lib/python3.9/site-packages/pluggy/hooks.py:286: in __call__
-        return self._hookexec(self, self.get_hookimpls(), kwargs)
-    /usr/lib/python3.9/site-packages/pluggy/manager.py:93: in _hookexec
-        return self._inner_hookexec(hook, methods, kwargs)
-    /usr/lib/python3.9/site-packages/pluggy/manager.py:84: in <lambda>
-        self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
-    html5lib/tests/conftest.py:105: in pytest_collect_file
-        return TokenizerFile(path, parent)
-    /usr/lib/python3.9/site-packages/_pytest/nodes.py:95: in __call__
-        warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), 
stacklevel=2)
-    E   pytest.PytestDeprecationWarning: Direct construction of TokenizerFile 
has been deprecated, please use TokenizerFile.from_parent.
-    E   See 
https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent
 for more details.
-
-Fixes https://github.com/html5lib/html5lib-python/issues/505
----
- html5lib/tests/conftest.py          | 15 ++++++++++++---
- html5lib/tests/sanitizer.py         |  2 +-
- html5lib/tests/tokenizer.py         | 10 +++++-----
- html5lib/tests/tree_construction.py | 20 ++++++++++----------
- requirements-test.txt               |  2 +-
- 5 files changed, 29 insertions(+), 20 deletions(-)
+and part of 4a87368b71090f1432df6302f178c4babfcec93f
 
 diff --git a/html5lib/tests/conftest.py b/html5lib/tests/conftest.py
 index dad167c5..fffeb50c 100644
@@ -151,3 +117,33 @@ index 1ef6e725..fb0657bf 100644
          item.add_marker(pytest.mark.treewalker)
          yield item
 
+diff --git a/html5lib/tests/tokenizer.py b/html5lib/tests/tokenizer.py
+index cc9897a..b49d2e6 100644
+--- a/html5lib/tests/tokenizer.py
++++ b/html5lib/tests/tokenizer.py
+@@ -246,7 +246,9 @@ class TokenizerTest(pytest.Item):
+     def repr_failure(self, excinfo):
+         traceback = excinfo.traceback
+         ntraceback = traceback.cut(path=__file__)
+-        excinfo.traceback = ntraceback.filter()
++        pytest_ver = getattr(pytest, "version_tuple", ())
++        filter_args = (excinfo,) if pytest_ver >= (7, 4, 0) else ()
++        excinfo.traceback = ntraceback.filter(*filter_args)
+ 
+         return excinfo.getrepr(funcargs=True,
+                                showlocals=False,
+diff --git a/html5lib/tests/tree_construction.py 
b/html5lib/tests/tree_construction.py
+index fb0657b..363b48c 100644
+--- a/html5lib/tests/tree_construction.py
++++ b/html5lib/tests/tree_construction.py
+@@ -135,7 +135,9 @@ class ParserTest(pytest.Item):
+     def repr_failure(self, excinfo):
+         traceback = excinfo.traceback
+         ntraceback = traceback.cut(path=__file__)
+-        excinfo.traceback = ntraceback.filter()
++        pytest_ver = getattr(pytest, "version_tuple", ())
++        filter_args = (excinfo,) if pytest_ver >= (7, 4, 0) else ()
++        excinfo.traceback = ntraceback.filter(*filter_args)
+ 
+         return excinfo.getrepr(funcargs=True,
+                                showlocals=False,

diff --git a/dev-python/html5lib/html5lib-1.1-r1.ebuild 
b/dev-python/html5lib/html5lib-1.1-r1.ebuild
index 7aaf19a606af..85d2d88a1104 100644
--- a/dev-python/html5lib/html5lib-1.1-r1.ebuild
+++ b/dev-python/html5lib/html5lib-1.1-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -36,3 +36,8 @@ BDEPEND="
 "
 
 distutils_enable_tests pytest
+
+python_test() {
+       local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+       epytest -p pytest_expect
+}

Reply via email to