@samitouri / QOSamiQemu / commits / e4b833c21e

tests/functional/qemu_test: Silence warnings from pylint in tesseract.py

Pylint complains: tesseract.py:1:0: C0114: Missing module docstring (missing-module-docstring) tesseract.py:12:0: C0116: Missing function or method docstring (missing-function-docstring) tesseract.py:15:11: W1510: 'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check) tesseract.py:12:30: W0613: Unused argument 'tesseract_args' (unused-argument) Thus add the missing bits and remove the unused tesseract_args argument. While we're at it, also add a SPDX identifier instead of the weird three dots at the beginning of the file, and drop the license boilerplate text. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-ID: <20260422071145.244820-1-thuth@redhat.com>

Thomas Huth committed Apr 22, 2026 at 09:11 UTC e4b833c21e1032cdcf5edfb7de3dee71ca07fb53
1 file changed +8 -6
tests/functional/qemu_test/tesseract.py
+8 -6
@@ -1,19 +1,21 @@
1 -# ...
1 +# SPDX-License-Identifier: GPL-2.0-or-later
2 #
3 # Copyright (c) 2019 Philippe Mathieu-Daudé
4 -#
5 -# This work is licensed under the terms of the GNU GPL, version 2 or
6 -# later. See the COPYING file in the top-level directory.
4 +'''
5 +Tesseract is an program for doing Optical Character Recognition (OCR),
6 +which can be used in the tests to extract text from screenshots.
7 +'''
8
9 import logging
10 from subprocess import run
11
12
12 -def tesseract_ocr(image_path, tesseract_args=''):
13 +def tesseract_ocr(image_path):
14 + ''' Run the tesseract OCR to extract text from a screenshot '''
15 console_logger = logging.getLogger('console')
16 console_logger.debug(image_path)
17 proc = run(['tesseract', image_path, 'stdout'],
16 - capture_output=True, encoding='utf8')
18 + capture_output=True, encoding='utf8', check=False)
19 if proc.returncode:
20 return None
21 lines = []