Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-intel committed Sep 3, 2024
1 parent 39b1332 commit 849306c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/test_pip_repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import requests
import requests_mock

from filelock import FileLock
from filelock import FileLock, Timeout

from conda_lock._vendor.poetry.locations import DEFAULT_CACHE_DIR
from conda_lock.conda_lock import DEFAULT_LOCKFILE_NAME, run_lock
Expand Down Expand Up @@ -148,11 +148,17 @@ def poetry_cache():
)

# Grab a lock
with FileLock(to_delete.parent / ".conda_lock.lock"):
yield
# Do another independent check that triggers even if we're in optimized mode
if "pypoetry-conda-lock" in to_delete.parts:
shutil.rmtree(DEFAULT_CACHE_DIR, ignore_errors=True)
lock = FileLock(to_delete.parent / ".conda_lock.lock")
try:
with lock.acquire(timeout=300):
yield
# Do another independent check that triggers even if we're in optimized mode
if "pypoetry-conda-lock" in to_delete.parts:
shutil.rmtree(DEFAULT_CACHE_DIR, ignore_errors=True)
else:
assert False, f"Unexpected cache directory: {to_delete}"
except Timeout:
assert False, "Could not acquire lock {to_delete.parent}/.conda_lock.lock for cache cleanup"


def test_it_uses_pip_repositories_with_env_var_substitution(
Expand Down

0 comments on commit 849306c

Please sign in to comment.