[Concept,02/27] test/py: Allow --help without a build directory

Message ID 20260119204130.3972647-3-sjg@u-boot.org
State New
Headers
Series Expo debugging and textedit improvements (part E) |

Commit Message

Simon Glass Jan. 19, 2026, 8:40 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Currently running './test/py/test.py --help' fails with an error about
.config not existing. This is because pytest_configure() tries to parse
the build configuration even when just showing help.

Add an early return when config.option.help is set, so users can view
the help text without needing a build directory.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 test/py/conftest.py | 4 ++++
 1 file changed, 4 insertions(+)
  

Patch

diff --git a/test/py/conftest.py b/test/py/conftest.py
index bd0c226276a..8efbe0d01c6 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -239,6 +239,10 @@  def pytest_configure(config):
     Returns:
         Nothing.
     """
+    # Skip full configuration when just showing help
+    if config.option.help:
+        return
+
     def parse_config(conf_file):
         """Parse a config file, loading it into the ubconfig container