scripts: Fix twisterlib for ruff - B023
This fixes ruff linting error B023, where function definitions use loop variables incorrectly. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
parent
9584eaee2d
commit
12a374cc8b
2 changed files with 12 additions and 4 deletions
|
@ -847,7 +847,6 @@
|
||||||
]
|
]
|
||||||
"./scripts/pylib/twister/twisterlib/testplan.py" = [
|
"./scripts/pylib/twister/twisterlib/testplan.py" = [
|
||||||
"B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default
|
"B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default
|
||||||
"B023", # https://docs.astral.sh/ruff/rules/function-uses-loop-variable
|
|
||||||
"E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file
|
"E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file
|
||||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||||
"F401", # https://docs.astral.sh/ruff/rules/unused-import
|
"F401", # https://docs.astral.sh/ruff/rules/unused-import
|
||||||
|
|
|
@ -372,19 +372,28 @@ class TestPlan:
|
||||||
for test in sorted(tests_list):
|
for test in sorted(tests_list):
|
||||||
if test.startswith("sample."):
|
if test.startswith("sample."):
|
||||||
sec = test.split(".")
|
sec = test.split(".")
|
||||||
area = find(samples, lambda node: node.name == sec[1] and node.parent == samples)
|
area = find(
|
||||||
|
samples,
|
||||||
|
lambda node, sname=sec[1]: node.name == sname and node.parent == samples
|
||||||
|
)
|
||||||
if not area:
|
if not area:
|
||||||
area = Node(sec[1], parent=samples)
|
area = Node(sec[1], parent=samples)
|
||||||
|
|
||||||
Node(test, parent=area)
|
Node(test, parent=area)
|
||||||
else:
|
else:
|
||||||
sec = test.split(".")
|
sec = test.split(".")
|
||||||
area = find(tests, lambda node: node.name == sec[0] and node.parent == tests)
|
area = find(
|
||||||
|
tests,
|
||||||
|
lambda node, sname=sec[0]: node.name == sname and node.parent == tests
|
||||||
|
)
|
||||||
if not area:
|
if not area:
|
||||||
area = Node(sec[0], parent=tests)
|
area = Node(sec[0], parent=tests)
|
||||||
|
|
||||||
if area and len(sec) > 2:
|
if area and len(sec) > 2:
|
||||||
subarea = find(area, lambda node: node.name == sec[1] and node.parent == area)
|
subarea = find(
|
||||||
|
area, lambda node, sname=sec[1], sparent=area: node.name == sname
|
||||||
|
and node.parent == sparent
|
||||||
|
)
|
||||||
if not subarea:
|
if not subarea:
|
||||||
subarea = Node(sec[1], parent=area)
|
subarea = Node(sec[1], parent=area)
|
||||||
Node(test, parent=subarea)
|
Node(test, parent=subarea)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue