Skip to contentSkip to conversation

python3-pytest-relaxed: Add recipe

PATCH New Leon Anavi 1 participant 2 messages Jul 21

lore
Share & tools
lore

Leon Anavi

author
#0 lore raw

PATCH 1/2 python3-pytest-relaxed: Add recipe

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.

---
 ...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
meta-python/recipes-devtools/python/python3-pytest-relaxed/0001-pytest_relaxed-plugin.py-Handle-terminalreporter.patch new file +38 -0
new file mode 100644
index 0000000000..ef16460a32
@@ -0,0 +1,38 @@
+From f9822e9fdc2bfb7762eb2bc740f16bbe543e500b Mon Sep 17 00:00:00 2001
+From: Leon Anavi <[email protected]>
+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 <[email protected]>
+---
+ 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
+
meta-python/recipes-devtools/python/python3-pytest-relaxed_2.0.2.bb new file +16 -0
new file mode 100644
index 0000000000..6e56d20b8d
@@ -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 \
+"
Signature · 1 line
2.47.3
author
#1 lore raw

PATCH 2/2 python3-invoke: Enable tests

Inherit ptest-python-pytest and include tests for invoke. Use -s because some tests read from stdin while output is captured. Skip tests that require a real terminal.

---
 .../python/python3-invoke/run-ptest           | 19 ++++++++++++
 .../python/python3-invoke_3.0.3.bb            | 29 ++++++++++++++-----
 2 files changed, 40 insertions(+), 8 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-invoke/run-ptest
meta-python/recipes-devtools/python/python3-invoke/run-ptest new file +19 -0
new file mode 100644
index 0000000000..7487702f2d
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+pytest -s --automake \
+  --deselect "tests/runners.py::Local_::pty::when_pty_True_we_use_pty_fork_and_os_exec" \
+  --deselect "tests/runners.py::Local_::pty::pty_uses_WEXITSTATUS_if_WIFEXITED" \
+  --deselect "tests/runners.py::Local_::pty::pty_uses_WTERMSIG_if_WIFSIGNALED" \
+  --deselect "tests/runners.py::Local_::pty::WTERMSIG_result_turned_negative_to_match_subprocess" \
+  --deselect "tests/runners.py::Local_::pty::pty_is_set_to_controlling_terminal_size" \
+  --deselect "tests/runners.py::Local_::pty::spurious_OSErrors_handled_gracefully" \
+  --deselect "tests/runners.py::Local_::pty::other_spurious_OSErrors_handled_gracefully" \
+  --deselect "tests/runners.py::Local_::pty::non_spurious_OSErrors_bubble_up" \
+  --deselect "tests/runners.py::Local_::pty::stop_mutes_errors_on_pty_close" \
+  --deselect "tests/runners.py::Local_::pty::fallback::can_be_overridden_by_kwarg" \
+  --deselect "tests/runners.py::Local_::pty::fallback::can_be_overridden_by_config" \
+  --deselect "tests/runners.py::Local_::pty::fallback::overridden_fallback_affects_result_pty_value" \
+  --deselect "tests/runners.py::Local_::shell::defaults_to_bash_or_cmdexe_when_pty_True" \
+  --deselect "tests/runners.py::Local_::shell::may_be_overridden_when_pty_True" \
+  --deselect "tests/runners.py::Local_::env::uses_execve_for_pty_True" \
+  --deselect "tests/runners.py::Local_::get_pid::is_top_level_pid_when_using_pty"
meta-python/recipes-devtools/python/python3-invoke_3.0.3.bb +21 -8
index e9d19da088..a5e6198ce8 100644
@@ -3,16 +3,29 @@ HOMEPAGE = "https://www.pyinvoke.org/"
 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=a8815068973f31b78c328dc067e297ab"
 
+SRC_URI += "file://run-ptest"
+
 SRC_URI[sha256sum] = "437b6a622223824380bfb4e64f612711a6b648c795f565efc8625af66fb57f0c"
 
-inherit pypi python_setuptools_build_meta
+inherit pypi python_setuptools_build_meta ptest-python-pytest
 
 RDEPENDS:${PN} += " \
-        python3-fcntl \
-        python3-json \
-        python3-logging \
-        python3-pprint \
-        python3-terminal \
-        python3-unittest \
-        python3-unixadmin \
+    python3-fcntl \
+    python3-json \
+    python3-logging \
+    python3-pprint \
+    python3-terminal \
+    python3-unittest \
+    python3-unixadmin \
+"
+
+RDEPENDS:${PN}-ptest += " \
+    python3-pytest \
+    python3-pytest-benchmark \
+    python3-core \
+    python3-io \
+    python3-pytest-relaxed \
+    python3-icecream \
+    python3-unittest \
+    python3-unittest-automake-output \
 "
Signature · 1 line
2.47.3