diff mbox series

[meta-python,1/2] python3-pytest-relaxed: Add recipe

Message ID 20260721141105.2648468-1-leon.anavi@konsulko.com
State Accepted
Headers show
Series [meta-python,1/2] python3-pytest-relaxed: Add recipe | expand

Commit Message

Leon Anavi July 21, 2026, 2:11 p.m. UTC
Add recipe for pytest-relaxed, a relaxed test discovery/organization
for pytest, release 2.0.2:

- Fix dangling compatibility issues with pytest version 8.x.

Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
---
 ...ed-plugin.py-Handle-terminalreporter.patch | 38 +++++++++++++++++++
 .../python/python3-pytest-relaxed_2.0.2.bb    | 16 ++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pytest-relaxed/0001-pytest_relaxed-plugin.py-Handle-terminalreporter.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-pytest-relaxed_2.0.2.bb
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-pytest-relaxed/0001-pytest_relaxed-plugin.py-Handle-terminalreporter.patch b/meta-python/recipes-devtools/python/python3-pytest-relaxed/0001-pytest_relaxed-plugin.py-Handle-terminalreporter.patch
new file mode 100644
index 0000000000..ef16460a32
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pytest-relaxed/0001-pytest_relaxed-plugin.py-Handle-terminalreporter.patch
@@ -0,0 +1,38 @@ 
+From f9822e9fdc2bfb7762eb2bc740f16bbe543e500b Mon Sep 17 00:00:00 2001
+From: Leon Anavi <leon.anavi@konsulko.com>
+Date: Tue, 21 Jul 2026 14:05:17 +0300
+Subject: [PATCH] pytest_relaxed/plugin.py: Handle terminalreporter
+
+Guard against missing terminal reporter in pytest_configure because
+some plugins/configurations unregister or never register the
+builtin "terminalreporter" plugin, which caused an INTERNALERROR
+when RelaxedReporter tried to access builtin.config on None.
+
+Fixes:
+
+INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'config'
+
+Upstream-Status: Submitted [https://github.com/bitprophet/pytest-relaxed/pull/35]
+
+Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
+---
+ pytest_relaxed/plugin.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/pytest_relaxed/plugin.py b/pytest_relaxed/plugin.py
+index ed448de..840082b 100644
+--- a/pytest_relaxed/plugin.py
++++ b/pytest_relaxed/plugin.py
+@@ -42,6 +42,9 @@ def pytest_configure(config):
+     # TODO: we _may_ sometime want to do the isatty/slaveinput/etc checks that
+     # pytest-sugar does?
+     builtin = config.pluginmanager.getplugin("terminalreporter")
++    # Guard against missing terminal reporter
++    if builtin is None:
++        return
+     # Pass the configured, instantiated builtin terminal reporter to our
+     # instance so it can refer to e.g. the builtin reporter's configuration
+     ours = RelaxedReporter(builtin)
+-- 
+2.43.0
+
diff --git a/meta-python/recipes-devtools/python/python3-pytest-relaxed_2.0.2.bb b/meta-python/recipes-devtools/python/python3-pytest-relaxed_2.0.2.bb
new file mode 100644
index 0000000000..6e56d20b8d
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pytest-relaxed_2.0.2.bb
@@ -0,0 +1,16 @@ 
+SUMMARY = "Relaxed test discovery for pytest"
+HOMEPAGE = "https://github.com/bitprophet/pytest-relaxed"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=a8815068973f31b78c328dc067e297ab"
+
+SRC_URI += "file://0001-pytest_relaxed-plugin.py-Handle-terminalreporter.patch"
+
+SRC_URI[sha256sum] = "956ea028ec30dbbfb680dd8e7b4a7fb8f80a239595e88bace018bf2c0d718248"
+
+inherit pypi setuptools3
+
+RDEPENDS:${PN} += " \
+    python3-core \
+    python3-pytest \
+    python3-decorator \
+"