diff --git a/tests/test_cli.py b/tests/test_cli.py index 5c85c2191562391601dcf77f1615493dd352f3fb..9af48c82047dad7e271bbf17b4fdf5b5a81d062b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -61,7 +61,7 @@ JSON_PATH = Path(__file__).parent / "test_cli.hjson" # external test definition # ─────────────────────────────────────────────────────────────────────────────── # Load & validate test cases from JSON # ─────────────────────────────────────────────────────────────────────────────── -with JSON_PATH.open() as f: +with open(JSON_PATH, encoding="utf-8") as f: CLI_TEST_CASES: List[Dict[str, Any]] = hjson.load(f) logger.info("Loaded %d test cases from %s", len(CLI_TEST_CASES), JSON_PATH) @@ -322,11 +322,18 @@ def test_help_flag_writes_usage(cli_path: str, out_dir: Path) -> None: # Skip tests that depend on filesystem permission errors when running as root, # since root privileges override normal file permission checks. skip_if_root = pytest.mark.skipif( - os.geteuid() == 0, reason="Skipping tests requiring permission errors under root" + os.name == "posix" and os.geteuid() == 0, + reason="Skipping tests requiring permission errors under root", +) + +# Skip test on Windows ex: POSIX style directory permissions test +skip_on_windows = pytest.mark.skipif( + sys.platform == "win32", reason="Skipping permission based tests on Windows" ) @skip_if_root +@skip_on_windows @pytest.mark.cli def test_output_to_unwritable_directory( cli_path: str, mobilenet_tflite: Path, out_dir: Path