diff --git a/xemutest/test_base.py b/xemutest/test_base.py index 03956e7..f72240e 100755 --- a/xemutest/test_base.py +++ b/xemutest/test_base.py @@ -8,7 +8,6 @@ import subprocess import sys import time from pathlib import Path -from typing import Optional, Tuple, Union from pyfatx import Fatx @@ -25,10 +24,10 @@ class TestEnvironment: def __init__( self, - private_path: Union[str, Path], - xemu_path: Union[str, Path], - ffmpeg_path: Optional[str], - perceptualdiff_path: Optional[str], + private_path: str | Path, + xemu_path: str | Path, + ffmpeg_path: str | None, + perceptualdiff_path: str | None, disable_fullscreen: bool = False, ): self.private_path = Path(private_path) @@ -61,8 +60,8 @@ class TestBase: self, test_env: TestEnvironment, xbox_results_path: str, - results_out_path: Union[str, Path], - iso_path: Union[str, Path], + results_out_path: str | Path, + iso_path: str | Path, timeout: int = 60, ): cur_dir = Path.cwd() @@ -85,7 +84,7 @@ class TestBase: assert self.iso_path.is_file() if platform.system() == "Windows": - self.app: Optional[pywinauto.application.Application] = None + self.app: pywinauto.application.Application | None = None self.record_x: int = 0 self.record_y: int = 0 self.record_w: int = 0 @@ -298,10 +297,10 @@ class TestBase: def compare_images( self, - expected_path: Union[str, Path], - actual_path: Union[str, Path], - diff_result_path: Optional[Union[str, Path]] = None, - ) -> Tuple[bool, str]: + expected_path: str | Path, + actual_path: str | Path, + diff_result_path: str | Path | None = None, + ) -> tuple[bool, str]: """Perform a perceptual diff of the given images.""" if not self.test_env.perceptualdiff_enabled: return True, "" diff --git a/xemutest/test_nxdk_pgraph_tests.py b/xemutest/test_nxdk_pgraph_tests.py index 443910d..02d6539 100644 --- a/xemutest/test_nxdk_pgraph_tests.py +++ b/xemutest/test_nxdk_pgraph_tests.py @@ -3,7 +3,6 @@ import logging import shutil from pathlib import Path -from typing import Union import test_base @@ -18,8 +17,8 @@ class TestNXDKPgraphTests(test_base.TestBase): def __init__( self, test_env: test_base.TestEnvironment, - results_path: Union[str, Path], - test_data_path: Union[str, Path], + results_path: str | Path, + test_data_path: str | Path, ) -> None: test_data_path = Path(test_data_path) iso_path = test_data_path / "nxdk_pgraph_tests_xiso.iso" diff --git a/xemutest/test_xbe.py b/xemutest/test_xbe.py index 2358f45..589d667 100644 --- a/xemutest/test_xbe.py +++ b/xemutest/test_xbe.py @@ -1,7 +1,6 @@ """Test harness for test-xbe.""" from pathlib import Path -from typing import Union import test_base @@ -12,8 +11,8 @@ class TestXBE(test_base.TestBase): def __init__( self, test_env: test_base.TestEnvironment, - results_path: Union[str, Path], - test_data_path: Union[str, Path], + results_path: str | Path, + test_data_path: str | Path, ): test_data_path = Path(test_data_path) iso_path = test_data_path / "tester.iso"