Skip to content

Commit 8d7708f

Browse files
SwiftWing21claude
andcommitted
fix(ci): guard all test DB/file cleanup against Windows PermissionError
Wrap os.unlink() in try/except PermissionError in test_idle_evolution, test_boot_sequence, and test_rag — same SQLite WAL lock issue on Windows CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5dcfb40 commit 8d7708f

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

tests/test_boot_sequence.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ def test_sets_env_var_from_secrets(self):
3131
# (Only set if not already in env — clear first)
3232
os.environ.pop("TEST_SECRET_KEY", None)
3333
finally:
34-
os.unlink(tmp)
34+
try:
35+
os.unlink(tmp)
36+
except PermissionError:
37+
pass
3538

3639
def test_skips_comment_lines(self):
3740
from boot_sequence import _load_secrets

tests/test_idle_evolution.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def tearDown(self):
3030
except Exception:
3131
pass
3232
os.environ.pop("FLEET_TEST_DB", None)
33-
os.unlink(self.tmp.name)
33+
try:
34+
os.unlink(self.tmp.name)
35+
except PermissionError:
36+
pass
3437
import idle_evolution
3538
idle_evolution._staleness_cache.clear()
3639

@@ -115,7 +118,10 @@ def tearDown(self):
115118
except Exception:
116119
pass
117120
os.environ.pop("FLEET_TEST_DB", None)
118-
os.unlink(self.tmp.name)
121+
try:
122+
os.unlink(self.tmp.name)
123+
except PermissionError:
124+
pass
119125

120126
def test_log_idle_run_inserts_row(self):
121127
from idle_evolution import log_idle_run
@@ -145,7 +151,10 @@ def tearDown(self):
145151
except Exception:
146152
pass
147153
os.environ.pop("FLEET_TEST_DB", None)
148-
os.unlink(self.tmp.name)
154+
try:
155+
os.unlink(self.tmp.name)
156+
except PermissionError:
157+
pass
149158

150159
def test_returns_list(self):
151160
from idle_evolution import get_idle_stats

tests/test_rag.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ def test_hash_is_hex_string(self):
235235
f.write(b"hello world")
236236
tmp = f.name
237237
result = _file_hash(Path(tmp))
238-
os.unlink(tmp)
238+
try:
239+
os.unlink(tmp)
240+
except PermissionError:
241+
pass
239242
self.assertIsInstance(result, str)
240243
self.assertRegex(result, r"^[0-9a-f]+$")
241244

0 commit comments

Comments
 (0)