- 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 <[email protected]> --- scripts/patchtest | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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 """ -- 2.54.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#239104): https://lists.openembedded.org/g/openembedded-core/message/239104 Mute This Topic: https://lists.openembedded.org/mt/119873964/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
