diff --git a/tests/conftest.py b/tests/conftest.py index e2fcb9f80..75d027714 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,8 +1,10 @@ +from __future__ import annotations + import pathlib import tempfile import textwrap from io import BytesIO -from typing import Callable, Iterator, Optional +from typing import Callable, Iterator import pytest @@ -50,7 +52,7 @@ def make_mock_target(tmp_path: pathlib.Path) -> Iterator[Target]: def make_os_target( tmp_path: pathlib.Path, os_plugin: type[OSPlugin], - root_fs: Optional[Filesystem] = None, + root_fs: Filesystem | None = None, apply_target: bool = True, ) -> Target: mock_target = next(make_mock_target(tmp_path)) diff --git a/tests/plugins/os/windows/test__os.py b/tests/plugins/os/windows/test__os.py index 045a473b5..ae6540152 100644 --- a/tests/plugins/os/windows/test__os.py +++ b/tests/plugins/os/windows/test__os.py @@ -1,4 +1,6 @@ -from typing import Any, Iterator, Optional +from __future__ import annotations + +from typing import Any, Iterator import pytest @@ -39,7 +41,7 @@ def target_win_linux_folders(target_win: Filesystem, fs_linux_sys: Filesystem) - yield target_win -def map_version_value(target: Target, name: Optional[str], value: Any): +def map_version_value(target: Target, name: str | None, value: Any): if name is not None: hive = target.registry._root hive.map_value(CURRENT_VERSION_KEY, name, VirtualValue(hive, name, value)) @@ -62,7 +64,7 @@ def assert_value(result: Any, value: Any): def test_windowsplugin__legacy_curre_ntversion( version_target: Target, win_plugin: WindowsPlugin, - name: Optional[str], + name: str | None, value: Any, ): map_version_value(version_target, name, value) @@ -81,7 +83,7 @@ def test_windowsplugin__legacy_curre_ntversion( def test_windowsplugin__major_version( version_target: Target, win_plugin: WindowsPlugin, - name: Optional[str], + name: str | None, value: Any, ): map_version_value(version_target, name, value) @@ -100,7 +102,7 @@ def test_windowsplugin__major_version( def test_windowsplugin__minor_version( version_target: Target, win_plugin: WindowsPlugin, - name: Optional[str], + name: str | None, value: Any, ): map_version_value(version_target, name, value) @@ -137,7 +139,7 @@ def test_windowsplugin__nt_version( version_target: Target, win_plugin: WindowsPlugin, keys: list[tuple[str, Any]], - value: Optional[str], + value: str | None, ): for key_name, key_value in keys: map_version_value(version_target, key_name, key_value) @@ -236,7 +238,7 @@ def test_windowsplugin_version( version_target: Target, win_plugin: WindowsPlugin, keys: list[tuple[str, Any]], - value: Optional[str], + value: str | None, ): for key_name, key_value in keys: map_version_value(version_target, key_name, key_value)