scripts: Fix twisterlib for ruff - UP035
This fixes errors of type UP035 - deprecated import. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
parent
4175bbb4ce
commit
a29236d808
4 changed files with 12 additions and 17 deletions
|
@ -793,7 +793,6 @@
|
|||
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
|
||||
"UP021", # https://docs.astral.sh/ruff/rules/replace-universal-newlines
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP035", # https://docs.astral.sh/ruff/rules/deprecated-import
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/handlers.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
|
@ -880,7 +879,6 @@
|
|||
"UP022", # https://docs.astral.sh/ruff/rules/replace-stdout-stderr
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
"UP035", # https://docs.astral.sh/ruff/rules/deprecated-import
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/size_calc.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
|
@ -929,7 +927,6 @@
|
|||
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
|
||||
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
|
||||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
"UP035", # https://docs.astral.sh/ruff/rules/deprecated-import
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/twister_main.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
|
|
|
@ -18,7 +18,7 @@ import sys
|
|||
from datetime import datetime, timezone
|
||||
from importlib import metadata
|
||||
from pathlib import Path
|
||||
from typing import Generator, List
|
||||
from collections.abc import Generator
|
||||
|
||||
from twisterlib.constants import SUPPORTED_SIMS
|
||||
from twisterlib.coverage import supported_coverage_formats
|
||||
|
@ -59,7 +59,7 @@ def python_version_guard():
|
|||
sys.exit(1)
|
||||
|
||||
|
||||
installed_packages: List[str] = list(_get_installed_packages())
|
||||
installed_packages: list[str] = list(_get_installed_packages())
|
||||
PYTEST_PLUGIN_INSTALLED = 'pytest-twister-harness' in installed_packages
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import traceback
|
|||
import yaml
|
||||
from multiprocessing import Lock, Process, Value
|
||||
from multiprocessing.managers import BaseManager
|
||||
from typing import List
|
||||
from packaging import version
|
||||
import pathlib
|
||||
|
||||
|
@ -1156,7 +1155,7 @@ class ProjectBuilder(FilterBuilder):
|
|||
testcase.reason = tc_info.get('reason')
|
||||
|
||||
|
||||
def cleanup_artifacts(self, additional_keep: List[str] = []):
|
||||
def cleanup_artifacts(self, additional_keep: list[str] = []):
|
||||
logger.debug("Cleaning up {}".format(self.instance.build_dir))
|
||||
allow = [
|
||||
os.path.join('zephyr', '.config'),
|
||||
|
@ -1209,7 +1208,7 @@ class ProjectBuilder(FilterBuilder):
|
|||
|
||||
self._sanitize_files()
|
||||
|
||||
def _get_artifact_allow_list_for_domain(self, domain: str) -> List[str]:
|
||||
def _get_artifact_allow_list_for_domain(self, domain: str) -> list[str]:
|
||||
"""
|
||||
Return a list of files needed to test a given domain.
|
||||
"""
|
||||
|
@ -1223,14 +1222,14 @@ class ProjectBuilder(FilterBuilder):
|
|||
]
|
||||
return allow
|
||||
|
||||
def _get_binaries(self) -> List[str]:
|
||||
def _get_binaries(self) -> list[str]:
|
||||
"""
|
||||
Get list of binaries paths (absolute or relative to the
|
||||
self.instance.build_dir), basing on information from platform.binaries
|
||||
or runners.yaml. If they are not found take default binaries like
|
||||
"zephyr/zephyr.hex" etc.
|
||||
"""
|
||||
binaries: List[str] = []
|
||||
binaries: list[str] = []
|
||||
|
||||
platform = self.instance.platform
|
||||
if platform.binaries:
|
||||
|
@ -1254,7 +1253,7 @@ class ProjectBuilder(FilterBuilder):
|
|||
]
|
||||
return binaries
|
||||
|
||||
def _get_binaries_from_runners(self, domain='') -> List[str]:
|
||||
def _get_binaries_from_runners(self, domain='') -> list[str]:
|
||||
"""
|
||||
Get list of binaries paths (absolute or relative to the
|
||||
self.instance.build_dir) from runners.yaml file. May be used for
|
||||
|
@ -1273,9 +1272,9 @@ class ProjectBuilder(FilterBuilder):
|
|||
return []
|
||||
|
||||
runners_config: dict = runners_content['config']
|
||||
binary_keys: List[str] = ['elf_file', 'hex_file', 'bin_file']
|
||||
binary_keys: list[str] = ['elf_file', 'hex_file', 'bin_file']
|
||||
|
||||
binaries: List[str] = []
|
||||
binaries: list[str] = []
|
||||
for binary_key in binary_keys:
|
||||
binary_path = runners_config.get(binary_key)
|
||||
if binary_path is None:
|
||||
|
@ -1313,7 +1312,7 @@ class ProjectBuilder(FilterBuilder):
|
|||
return
|
||||
|
||||
runners_config: dict = runners_content_yaml['config']
|
||||
binary_keys: List[str] = ['elf_file', 'hex_file', 'bin_file']
|
||||
binary_keys: list[str] = ['elf_file', 'hex_file', 'bin_file']
|
||||
|
||||
for binary_key in binary_keys:
|
||||
binary_path = runners_config.get(binary_key)
|
||||
|
|
|
@ -11,7 +11,6 @@ import logging
|
|||
import contextlib
|
||||
import mmap
|
||||
import glob
|
||||
from typing import List
|
||||
|
||||
from twisterlib.mixins import DisablePyTestCollectionMixin
|
||||
from twisterlib.environment import canonical_zephyr_base
|
||||
|
@ -39,12 +38,12 @@ class ScanPathResult:
|
|||
ztest_suite_names Names of found ztest suites
|
||||
"""
|
||||
def __init__(self,
|
||||
matches: List[str] = None,
|
||||
matches: list[str] = None,
|
||||
warnings: str = None,
|
||||
has_registered_test_suites: bool = False,
|
||||
has_run_registered_test_suites: bool = False,
|
||||
has_test_main: bool = False,
|
||||
ztest_suite_names: List[str] = []):
|
||||
ztest_suite_names: list[str] = []):
|
||||
self.matches = matches
|
||||
self.warnings = warnings
|
||||
self.has_registered_test_suites = has_registered_test_suites
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue