aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/qemu_test/tesseract.py
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2024-12-17 15:59:49 +0000
committerThomas Huth <thuth@redhat.com>2024-12-17 19:39:53 +0100
commit37e9b19c34d9500164e33ccf377e1830e956bca0 (patch)
tree4699be481053c51effb54772ffc6d81c965b3234 /tests/functional/qemu_test/tesseract.py
parent3bb4c8b6134df5367675c4ade4f5c177d29fe903 (diff)
downloadqemu-37e9b19c34d9500164e33ccf377e1830e956bca0.zip
qemu-37e9b19c34d9500164e33ccf377e1830e956bca0.tar.gz
qemu-37e9b19c34d9500164e33ccf377e1830e956bca0.tar.bz2
tests/functional: replace 'run_cmd' with subprocess helpers
The 'run_cmd' helper is re-implementing a convenient helper that already exists in the form of the 'run' and 'check_call' methods provided by 'subprocess'. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20241217155953.3950506-29-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/functional/qemu_test/tesseract.py')
-rw-r--r--tests/functional/qemu_test/tesseract.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/functional/qemu_test/tesseract.py b/tests/functional/qemu_test/tesseract.py
index 1b78180..ede6c65 100644
--- a/tests/functional/qemu_test/tesseract.py
+++ b/tests/functional/qemu_test/tesseract.py
@@ -6,18 +6,18 @@
# later. See the COPYING file in the top-level directory.
import logging
+from subprocess import run
-from . import run_cmd
def tesseract_ocr(image_path, tesseract_args=''):
console_logger = logging.getLogger('console')
console_logger.debug(image_path)
- (stdout, stderr, ret) = run_cmd(['tesseract', image_path,
- 'stdout'])
- if ret:
+ proc = run(['tesseract', image_path, 'stdout'],
+ capture_output=True, encoding='utf8')
+ if proc.returncode:
return None
lines = []
- for line in stdout.split('\n'):
+ for line in proc.stdout.split('\n'):
sline = line.strip()
if len(sline):
console_logger.debug(sline)