[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3dff083d3534b3fdc9f8b25dca1681cb3a8279c.1770128540.git.mchehab+huawei@kernel.org>
Date: Tue, 3 Feb 2026 15:55:29 +0100
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Jonathan Corbet <corbet@....net>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
linux-kernel@...r.kernel.org,
Jani Nikula <jani.nikula@...ux.intel.com>,
Shuah Khan <skhan@...uxfoundation.org>
Subject: [PATCH 01/15] unittests: unittest_helper: store verbosity at the environment
As tests may want to add their own verbosed messages, pass
the defined verbosity level to the test classes via env.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
tools/lib/python/unittest_helper.py | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/tools/lib/python/unittest_helper.py b/tools/lib/python/unittest_helper.py
index d2efb78d8561..55d444cd73d4 100755
--- a/tools/lib/python/unittest_helper.py
+++ b/tools/lib/python/unittest_helper.py
@@ -279,14 +279,19 @@ class TestUnits:
if not caller_file and not suite:
raise TypeError("Either caller_file or suite is needed at TestUnits")
- if env:
- patcher = patch.dict(os.environ, env)
- patcher.start()
- # ensure it gets stopped after
- atexit.register(patcher.stop)
-
verbose = args.verbose
+ if not env:
+ env = os.environ.copy()
+
+ env["VERBOSE"] = f"{verbose}"
+
+ patcher = patch.dict(os.environ, env)
+ patcher.start()
+ # ensure it gets stopped after
+ atexit.register(patcher.stop)
+
+
if verbose >= 2:
unittest.TextTestRunner(verbosity=verbose).run = lambda suite: suite
--
2.52.0
Powered by blists - more mailing lists