scripts: Fix twisterlib for ruff - F541
This fixes ruff linting error F541, where an fstring is used when a normal string would suffice. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
parent
8353a6c95f
commit
7746a97e31
7 changed files with 10 additions and 16 deletions
|
@ -766,7 +766,6 @@
|
|||
]
|
||||
"./scripts/pylib/twister/twisterlib/coverage.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
]
|
||||
|
@ -776,7 +775,6 @@
|
|||
]
|
||||
"./scripts/pylib/twister/twisterlib/handlers.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||
"UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation
|
||||
"UP030", # https://docs.astral.sh/ruff/rules/format-literals
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
|
@ -788,7 +786,6 @@
|
|||
]
|
||||
"./scripts/pylib/twister/twisterlib/harness.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
]
|
||||
|
@ -802,13 +799,11 @@
|
|||
]
|
||||
"./scripts/pylib/twister/twisterlib/reports.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/runner.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
]
|
||||
|
@ -824,7 +819,6 @@
|
|||
"E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"F401", # https://docs.astral.sh/ruff/rules/unused-import
|
||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
]
|
||||
|
|
|
@ -413,7 +413,7 @@ def run_coverage(testplan, options):
|
|||
elif os.path.exists(zephyr_sdk_gcov_tool):
|
||||
gcov_tool = zephyr_sdk_gcov_tool
|
||||
else:
|
||||
logger.error(f"Can't find a suitable gcov tool. Use --gcov-tool or set ZEPHYR_SDK_INSTALL_DIR.")
|
||||
logger.error("Can't find a suitable gcov tool. Use --gcov-tool or set ZEPHYR_SDK_INSTALL_DIR.")
|
||||
sys.exit(1)
|
||||
else:
|
||||
gcov_tool = str(options.gcov_tool)
|
||||
|
|
|
@ -137,7 +137,7 @@ class Handler:
|
|||
self.instance.execution_time = handler_time
|
||||
for tc in self.instance.testcases:
|
||||
tc.status = TwisterStatus.FAIL
|
||||
self.instance.reason = f"Testsuite mismatch"
|
||||
self.instance.reason = "Testsuite mismatch"
|
||||
logger.debug("Test suite names were not printed or some of them in " \
|
||||
"output do not correspond with expected: %s",
|
||||
str(expected_suite_names))
|
||||
|
|
|
@ -201,7 +201,7 @@ class Robot(Harness):
|
|||
command.append(f'{v}')
|
||||
|
||||
if self.path is None:
|
||||
raise PytestHarnessException(f'The parameter robot_testsuite is mandatory')
|
||||
raise PytestHarnessException('The parameter robot_testsuite is mandatory')
|
||||
|
||||
if isinstance(self.path, list):
|
||||
for suite in self.path:
|
||||
|
|
|
@ -106,7 +106,7 @@ class Reporting:
|
|||
else:
|
||||
if status == TwisterStatus.NONE:
|
||||
logger.debug(f"{name}: No status")
|
||||
ET.SubElement(eleTestcase, ReportStatus.SKIP, type=f"untested", message="No results captured, testsuite misconfiguration?")
|
||||
ET.SubElement(eleTestcase, ReportStatus.SKIP, type="untested", message="No results captured, testsuite misconfiguration?")
|
||||
else:
|
||||
logger.error(f"{name}: Unknown status '{status}'")
|
||||
|
||||
|
@ -523,7 +523,7 @@ class Reporting:
|
|||
log_txt = f"The following issues were found (showing the all {count} items):"
|
||||
elif self.env.options.report_summary:
|
||||
count = self.env.options.report_summary
|
||||
log_txt = f"The following issues were found "
|
||||
log_txt = "The following issues were found "
|
||||
if count > self.instance_fail_count:
|
||||
log_txt += f"(presenting {self.instance_fail_count} out of the {count} items requested):"
|
||||
else:
|
||||
|
@ -551,7 +551,7 @@ class Reporting:
|
|||
break
|
||||
if cnt == 0 and self.env.options.report_summary is not None:
|
||||
logger.info("-+" * 40)
|
||||
logger.info(f"No errors/fails found")
|
||||
logger.info("No errors/fails found")
|
||||
|
||||
if cnt and example_instance:
|
||||
cwd_rel_path = os.path.relpath(example_instance.testsuite.source_dir, start=os.getcwd())
|
||||
|
@ -563,7 +563,7 @@ class Reporting:
|
|||
logger.info("")
|
||||
logger.info(f"west twister -p {example_instance.platform.name} -s {example_instance.testsuite.name}"
|
||||
f"{extra_parameters}")
|
||||
logger.info(f"or with west:")
|
||||
logger.info("or with west:")
|
||||
logger.info(f"west build -p -b {example_instance.platform.name} {cwd_rel_path} -T {example_instance.testsuite.id}")
|
||||
logger.info("-+" * 40)
|
||||
|
||||
|
|
|
@ -1018,7 +1018,7 @@ class ProjectBuilder(FilterBuilder):
|
|||
if self.instance.status == TwisterStatus.NOTRUN:
|
||||
run_conditions = f"(run:{self.instance.run}, handler.ready:{self.instance.handler.ready})"
|
||||
logger.debug(f"Instance {self.instance.name} can't run {run_conditions}")
|
||||
self.instance.add_missing_case_status(TwisterStatus.NOTRUN, f"Nowhere to run")
|
||||
self.instance.add_missing_case_status(TwisterStatus.NOTRUN, "Nowhere to run")
|
||||
next_op = 'report'
|
||||
except StatusAttributeError as sae:
|
||||
logger.error(str(sae))
|
||||
|
|
|
@ -786,7 +786,7 @@ class TestPlan:
|
|||
if platform_filter:
|
||||
logger.debug(f"Checking platform filter: {platform_filter}")
|
||||
# find in aliases and rename
|
||||
self.verify_platforms_existence(platform_filter, f"platform_filter")
|
||||
self.verify_platforms_existence(platform_filter, "platform_filter")
|
||||
for pf in platform_filter:
|
||||
logger.debug(f"Checking platform in filter: {pf}")
|
||||
if pf in self.platform_names:
|
||||
|
@ -981,7 +981,7 @@ class TestPlan:
|
|||
# Search and check that all required snippet files are found
|
||||
for this_snippet in snippet_args['snippets']:
|
||||
if this_snippet not in found_snippets:
|
||||
logger.error(f"Can't find snippet '%s' for test '%s'", this_snippet, ts.name)
|
||||
logger.error("Can't find snippet '%s' for test '%s'", this_snippet, ts.name)
|
||||
instance.status = TwisterStatus.ERROR
|
||||
instance.reason = f"Snippet {this_snippet} not found"
|
||||
missing_snippet = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue