From: Trevor Gamblin Date: Thu, 18 Jun 2026 20:36:28 +0000 (-0400) Subject: scripts/patchtest: simplify _runner() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b054bb3949657ef48a98c5e03cd864295e65bb32;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git scripts/patchtest: simplify _runner() - Use the test suite's countTestCases() method directly instead of creating a variable - Simplify return logic - we still want to fail early if there are no test suites to use, but otherwise we can reduce it to a single return value determination based on the result of runner.run() - Add a newline above where the 'runner' variable is initialized Signed-off-by: Trevor Gamblin Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- diff --git a/scripts/patchtest b/scripts/patchtest index ff8e8b11bd..795fad511f 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -123,11 +123,11 @@ def _runner(resultklass, prefix=None): pattern=PatchtestParser.pattern, top_level_dir=PatchtestParser.topdir, ) - ntc = suite.countTestCases() # if there are no test cases, just quit - if not ntc: + if not suite.countTestCases(): return 2 + runner = unittest.TextTestRunner(resultclass=resultklass, verbosity=0) try: @@ -135,11 +135,8 @@ def _runner(resultklass, prefix=None): except: logger.error(traceback.print_exc()) logger.error('patchtest: something went wrong') - return 1 - if result.test_failure or result.test_error: - return 1 - return 0 + return 1 if (result.test_failure or result.test_error) else 0 def run(patch, logfile=None): """ Load, setup and run pre and post-merge tests """