upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEmma <47298336+zzEmmazz@users.noreply.github.com>2026-11-22 23:21:26 +0200
committerEmma <47298336+zzEmmazz@users.noreply.github.com>2026-11-22 23:21:26 +0200
commit90a6b5d052d5e784cfbfd84002f8623612ed68b5 (patch)
tree31f825c319181a964f60d88848ea459b0d465f03 /tests
parent35fe778eb61071d8dbe5f82f9347ee303f7c212e (diff)
first_light.py: refuse a linked first_light even when nothing stale lies behind it
Review of #3577: reset_run_folders() judged first_light only through the dxbc and spirv folders it found. When first_light is a symlink or a junction to a folder that has neither, there was nothing to judge, and the new dxbc was created in the folder the link points to, outside the work folder. first_light itself is now checked before its children. tests/test_first_light.py gains the case with neither folder behind the link (symlink and junction): it fails on the previous commit with "SystemExit not raised" and the far folder gets a dxbc; with the check the run is refused and the far folder stays empty. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_first_light.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_first_light.py b/tests/test_first_light.py
index f8cca7b72..dc2db8728 100644
--- a/tests/test_first_light.py
+++ b/tests/test_first_light.py
@@ -338,9 +338,26 @@ class RunFolderTests(unittest.TestCase):
338 work, outside = self.linked(kind, "") 338 work, outside = self.linked(kind, "")
339 with self.assertRaises(SystemExit) as refused: 339 with self.assertRaises(SystemExit) as refused:
340 fl.reset_run_folders(str(work)) 340 fl.reset_run_folders(str(work))
341 self.assertIn(str(work / "first_light" / "dxbc"), str(refused.exception)) 341 self.assertIn(str(work / "first_light"), str(refused.exception))
342 self.assertNotIn("\n", str(refused.exception))
342 self.assertEqual(self.files(outside), ["dxbc/keep.dxbc", "keep.dxbc"]) 343 self.assertEqual(self.files(outside), ["dxbc/keep.dxbc", "keep.dxbc"])
343 344
345 def test_a_linked_first_light_with_no_run_folders_is_refused_too(self) -> None:
346 # Nothing stale lies behind the link, so only the check of first_light itself can refuse it; without that
347 # check the new dxbc was created in the folder the link points to, outside the work folder.
348 for kind in LINK_KINDS:
349 with self.subTest(kind=kind):
350 work, outside = self.tmp / kind / "work", self.tmp / kind / "outside"
351 outside.mkdir(parents=True)
352 work.mkdir()
353 if not link_folder(kind, work / "first_light", outside):
354 self.skipTest(f"cannot create a {kind} here")
355 with self.assertRaises(SystemExit) as refused:
356 fl.reset_run_folders(str(work))
357 self.assertIn(str(work / "first_light"), str(refused.exception))
358 self.assertNotIn("\n", str(refused.exception))
359 self.assertEqual(os.listdir(outside), [])
360
344 def test_a_file_that_cannot_be_removed_stops_the_run(self) -> None: 361 def test_a_file_that_cannot_be_removed_stops_the_run(self) -> None:
345 self.prepare("first") 362 self.prepare("first")
346 held = self.staged / "first.dxbc" 363 held = self.staged / "first.dxbc"