https://github.com/Diaoul/subliminal/commit/8f410a261a490cea5f10b60afe281490859b0977 From 8f410a261a490cea5f10b60afe281490859b0977 Mon Sep 17 00:00:00 2001 From: getzze Date: Mon, 5 May 2025 23:10:49 +0100 Subject: [PATCH] Make win32-setctime an optional tests dependency, only for win32 platform (#1278) --- pyproject.toml | 2 +- tests/test_video.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bbe8f7c99..52054d5ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,7 @@ tests = [ "sympy", "colorama", # used in scripts/ "vcrpy>=5", # keep synchronized with docs dependencies - "win32-setctime", + "win32-setctime; sys_platform=='win32'", "importlib_metadata>=4.6; python_version<'3.10'", ] types = [ diff --git a/tests/test_video.py b/tests/test_video.py index c8625b5d3..06c737596 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -7,7 +7,6 @@ from unittest.mock import Mock import pytest -from win32_setctime import SUPPORTED, setctime from subliminal.utils import sanitize, timestamp from subliminal.video import Episode, Movie, Video @@ -40,6 +39,12 @@ def test_video_exists_age_no_use_ctime( def test_video_exists_age(movies: dict[str, Movie], tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + try: + from win32_setctime import SUPPORTED, setctime + except (ImportError, ModuleNotFoundError): + SUPPORTED = False + setctime = None + monkeypatch.chdir(tmp_path) video = movies['man_of_steel'] video_path = tmp_path / video.name