From 681c0118e3d4d9545b28215f9246a47ef0b64006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Mon, 2 Nov 2026 17:08:28 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(tests):=20check=20active=20W?= =?UTF-8?q?indows=20lock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_cache.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_cache.py b/tests/test_cache.py index 933d44f..0ae4d04 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import pytest -from filelock import FileLock +from filelock import FileLock, Timeout from python_discovery._cache import DiskCache, DiskContentStore, NoOpCache, NoOpContentStore @@ -97,12 +97,11 @@ def acquire() -> None: assert acquired -def test_disk_content_store_keeps_lock_path_without_posix(tmp_path: Path, mocker: MockerFixture) -> None: +def test_disk_content_store_locks_legacy_path_without_posix(tmp_path: Path, mocker: MockerFixture) -> None: platform_os = mocker.patch("python_discovery._cache.os", autospec=True) platform_os.name = "nt" - with DiskContentStore(tmp_path, "test").locked(): - pass - assert (tmp_path / "test.lock").exists() + with DiskContentStore(tmp_path, "test").locked(), pytest.raises(Timeout): + FileLock(str(tmp_path / "test.lock")).acquire(timeout=0) assert not (tmp_path / "locks-v2").exists()