From c1c730a9bb8473123e0baa05a8485d2edada8b4f Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Thu, 19 Oct 2023 23:11:17 +0200 Subject: [PATCH] Tools: fix flake8 issue --- Tools/autotest/vehicle_test_suite.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/autotest/vehicle_test_suite.py b/Tools/autotest/vehicle_test_suite.py index fece6a02eaeb9..3949ee25c6a0d 100644 --- a/Tools/autotest/vehicle_test_suite.py +++ b/Tools/autotest/vehicle_test_suite.py @@ -20,6 +20,7 @@ import traceback from datetime import datetime from typing import List +import importlib.util import pexpect import fnmatch @@ -1549,7 +1550,9 @@ def __init__(self, self.generate_junit = generate_junit if generate_junit: try: - import junitparser + spec = importlib.util.find_spec("junitparser") + if spec is None: + raise ImportError except ImportError as e: raise ImportError(f"Junit export need junitparser package.\n {e} \nTry: python -m pip install junitparser")