summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch')
-rw-r--r--meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch b/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
new file mode 100644
index 0000000000..b4d7794e47
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pytest-picked/0001-adjust-failing-tests-to-capture-only-ptest-output.patch
@@ -0,0 +1,51 @@
1From b9341394314e5dcaca0aa1d91fc3af28c64db387 Mon Sep 17 00:00:00 2001
2From: Tom Geelen <t.f.g.geelen@gmail.com>
3Date: Tue, 25 Nov 2025 20:42:15 +0100
4Subject: [PATCH] adjust failing tests to capture only ptest output
5
6The tests should only check for warnings emitted by the plugin itself,
7not for any other warnings that may be emitted by other plugins or pytest
8itself. This behavior is caused by the fact that pytest might throw some deprecation warnings
9or other warnings that are unrelated to the plugin being tested.
10
11Signed-off-by: Tom Geelen <t.f.g.geelen@gmail.com>
12Upstream-Status: Inappropriate [OE specific]
13---
14 tests/test_pytest_picked.py | 17 ++++++++++++++---
15 1 file changed, 14 insertions(+), 3 deletions(-)
16
17diff --git a/tests/test_pytest_picked.py b/tests/test_pytest_picked.py
18index fb2bedb..947b43a 100644
19--- a/tests/test_pytest_picked.py
20+++ b/tests/test_pytest_picked.py
21@@ -182,8 +182,13 @@ def test_should_accept_branch_as_mode(testdir, tmpdir, recwarn):
22 "Changed test folders... 0. []",
23 ]
24 )
25- assert len(recwarn) == 1
26- assert str(recwarn[0].message) == "Now `main` is the default parent branch"
27+ # Only count the plugin's own UserWarning about default parent branch
28+ plugin_warnings = [
29+ w
30+ for w in recwarn
31+ if w.category is UserWarning and "default parent branch" in str(w.message)
32+ ]
33+ assert len(plugin_warnings) == 1
34
35
36 def test_should_accept_unstaged_as_mode(testdir, tmpdir, recwarn):
37@@ -211,7 +216,13 @@ def test_should_accept_unstaged_as_mode(testdir, tmpdir, recwarn):
38 "Changed test folders... 0. []",
39 ]
40 )
41- assert len(recwarn) == 0
42+ # Ignore unrelated deprecation warnings from other plugins
43+ plugin_warnings = [
44+ w
45+ for w in recwarn
46+ if w.category is UserWarning and "default parent branch" in str(w.message)
47+ ]
48+ assert len(plugin_warnings) == 0
49
50
51 def test_should_not_run_the_tests_if_mode_is_invalid(testdir, tmpdir):