diff --git a/tools/ci/idf_pytest/plugin.py b/tools/ci/idf_pytest/plugin.py index 47a46ce088..cfa8d8ffcf 100644 --- a/tools/ci/idf_pytest/plugin.py +++ b/tools/ci/idf_pytest/plugin.py @@ -48,8 +48,8 @@ def requires_elf_or_map(case: PytestCase) -> bool: return False -def skipped_targets(item: Function) -> t.Set[str]: - def _get_temp_markers_disabled_targets(marker_name: str) -> t.Set[str]: +def skipped_targets(item: Function) -> set[str]: + def _get_temp_markers_disabled_targets(marker_name: str) -> set[str]: temp_marker = item.get_closest_marker(marker_name) if not temp_marker: @@ -102,7 +102,7 @@ class IdfLocalPlugin: with open(KNOWN_GENERATE_TEST_CHILD_PIPELINE_WARNINGS_FILEPATH) as fr: known_warnings_dict = yaml.safe_load(fr) or dict() - self.exclude_no_env_markers_test_cases: t.Set[str] = set(known_warnings_dict['no_env_marker_test_cases']) + self.exclude_no_env_markers_test_cases: set[str] = set(known_warnings_dict['no_env_marker_test_cases']) @staticmethod def get_param(item: Function, key: str, default: t.Any = None) -> t.Any: @@ -114,7 +114,7 @@ class IdfLocalPlugin: return item.callspec.params.get(key, default) or default @pytest.hookimpl(wrapper=True) - def pytest_collection_modifyitems(self, config: Config, items: t.List[Function]) -> t.Generator[None, None, None]: + def pytest_collection_modifyitems(self, config: Config, items: list[Function]) -> t.Generator[None, None, None]: yield # throw it back to idf-ci deselected_items = [] @@ -176,14 +176,14 @@ class IdfLocalPlugin: config = item.funcargs['config'] is_qemu = item.get_closest_marker('qemu') is not None - dut: t.Union[Dut, t.Tuple[Dut]] = item.funcargs['dut'] # type: ignore - if isinstance(dut, (list, tuple)): + dut: Dut | tuple[Dut] = item.funcargs['dut'] # type: ignore + if isinstance(dut, (list | tuple)): res = [] for i, _dut in enumerate(dut): res.extend( [ ChildCase( - format_case_id(target, config, case.name + f' {i}', is_qemu=is_qemu), + format_case_id(target, config, case.name, is_qemu=is_qemu), self.UNITY_RESULT_MAPPINGS[case.result], ) for case in _dut.testsuite.testcases @@ -206,7 +206,7 @@ class IdfLocalPlugin: """ Modify the junit reports. Format the unity c test case names. """ - tempdir: t.Optional[str] = item.funcargs.get('test_case_tempdir') # type: ignore + tempdir: str | None = item.funcargs.get('test_case_tempdir') # type: ignore if not tempdir: return