Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()


Expand Down
Loading