You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Long CI matrix runs (60+ jobs across OS/Python/backend combinations) were spinning up regardless of trivial failures. This adds fast-fail gates — a smoke test job and a pre-commit lint job — that the full matrix must pass before starting.
Changes
tests/test_smoke.py — 11 new @pytest.mark.smoke tests covering core functionality: imports, pickle/memory caching, clear_cache, stale_after, allow_none, set_global_params, cache_dpath. No external service dependencies; runs in ~0.13s.
pyproject.toml — Registers the smoke pytest marker.
.github/workflows/ci-test.yml — Adds two new jobs that gate the full matrix:
smoke-test: single Python 3.12/Ubuntu run of pytest -m smoke tests/test_smoke.py
pre-commit: runs pre-commit run --all-files to enforce code quality before expensive jobs start
pytester now declares needs: [smoke-test, pre-commit]
testing-guardian updated to depend on all three jobs
Added permissions: contents: read to all new/modified jobs
Original prompt
This section details on the original issue you should resolve
<issue_title>Add a smoke test suite</issue_title>
<issue_description>Add a smoke test suite that the full test suit workflow will depend on, to reduce long CI runs that can actually fail fast.
The full test suit should also depend on the pre-commit.ci flow.</issue_description>
Comments on the Issue (you are @copilot in this section)
@copilot analyze, explain the cause and suggest a plan to fix the failing test test_pickle_core which fails for Python 3.10 on Windows - writing your insights and recommendations here, as a comment on this PR - but do not implement it yet.
@copilot analyze, explain the cause and suggest a plan to fix the failing test test_pickle_core which fails for Python 3.10 on Windows - writing your insights and recommendations h...
Analysis of test_bad_cache_file[True] failure on Python 3.10 Windows
This is a pre-existing issue unrelated to the smoke-test changes (none of the files I modified touch tests/pickle_tests/test_pickle_core.py or src/cachier/cores/pickle.py).
Root cause
Where it fails: src/cachier/cores/pickle.py, line 148 — _clear_all_cache_files():
def_clear_all_cache_files(self) ->None:
path, name=os.path.split(self.cache_fpath)
forsubpathinos.listdir(path):
ifsubpath.startswith(f"{name}_"):
os.remove(os.path.join(path, subpath)) # <-- PermissionError here on Windows
Error: PermissionError: [WinError 32] The process cannot access the file because it is being used by another process
Why it happens on Windows only: Windows implements mandatory file locking (unlike Linux/macOS which use advisory locking). portalocker uses LockFileEx on Windows, which means while any thread holds a lock on a file, os.remove() on that file raises PermissionError.
The sequence that triggers it
test_bad_cache_file[True] loops through sleep_times * 2, calling _helper_bad_cache_file() each iteration.
Each call to _helper_bad_cache_file() starts two daemon threads and joins them with timeout=2.
_bad_cache (the underlying function) sleeps for 1 second and internally holds a portalocker exclusive lock on the separate-files cache file while computing.
If thread1.join(timeout=2) returns due to timeout before thread1 finishes, thread1 is still running and still holds the portalocker lock.
The next iteration immediately calls _bad_cache_decorated.clear_cache() → _clear_all_cache_files() → os.remove(), which fails because thread1 from the previous iteration is still holding the lock.
Suggested fix plan
The fix belongs in _clear_all_cache_files() in src/cachier/cores/pickle.py. The os.remove() call should be made resilient to transient Windows file-lock errors by adding a small retry loop:
This is the right layer to fix because clear_cache() is a public API that users also call, so it should be resilient to this Windows behaviour in production too — not just in tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Long CI matrix runs (60+ jobs across OS/Python/backend combinations) were spinning up regardless of trivial failures. This adds fast-fail gates — a smoke test job and a pre-commit lint job — that the full matrix must pass before starting.
Changes
tests/test_smoke.py— 11 new@pytest.mark.smoketests covering core functionality: imports, pickle/memory caching,clear_cache,stale_after,allow_none,set_global_params,cache_dpath. No external service dependencies; runs in ~0.13s.pyproject.toml— Registers thesmokepytest marker..github/workflows/ci-test.yml— Adds two new jobs that gate the full matrix:smoke-test: single Python 3.12/Ubuntu run ofpytest -m smoke tests/test_smoke.pypre-commit: runspre-commit run --all-filesto enforce code quality before expensive jobs startpytesternow declaresneeds: [smoke-test, pre-commit]testing-guardianupdated to depend on all three jobspermissions: contents: readto all new/modified jobsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.