Files
Vito a695457cce fix: Windows dev machines: pinned files survive a default clone; four tests stop depending on the machine (#636) (#637)
* fix: a default Windows clone keeps pinned files byte for byte; LoRA test no longer depends on TEMP (#636)

Git for Windows converts text files to CRLF on checkout by default, so a
fresh clone failed npm run --prefix tools/vendor check with Viewer.js
drift. .gitattributes now marks the pinned Viewer.js, Toolkit and concept
stylesheet files as never converted, and a test holds that for every
tracked file under them. .gitattributes stays out of the Registry package.

test_preview_writes_nothing_and_makes_no_requests expected the full
settings path, which only holds when the temp folder is outside the home
folder. On Windows %TEMP% is under the profile, so the review showed
~\... and the test failed. It now pins the home folder beside the temp
root.

* fix(tests): the Built-in instructions test reads Python source with either line ending (#636)

In a default Windows clone py/tagging_defaults.py is checked out with CRLF,
so the test's search for the closing paren missed and JSON.parse failed on
a carriage return: 1453 of 1454 frontend tests passed. The test now
normalizes CRLF before it slices the source.

* fix(tests): two more Windows machine failures: killed test servers, nearby ComfyUI (#636)

On a Windows machine with a virtual environment, the tests that start
tests/browser/server.py failed their cleanup with WinError 32 on the
server's log file, 3 of 3 runs. The venv's python.exe is a launcher that
runs the real interpreter as a child; killing the launcher returns while
Windows is still ending that child. The temp folder is now removed by
remove_when_released, which waits until the files are released, up to
30 s. CI never saw it: its Windows job runs a plain interpreter.

The diagnostics tests that expect no output folder ran in the temp root,
so the fallback's ../../ComfyUI/output could reach a real ComfyUI next to
it. They now run two folders deep inside the temp folder.

* docs(testing): what a Windows development machine needs for the suite (#636)

* fix(tests): one import style in test_process_cleanup; the line-ending test ignores GIT_* (#636)

Code quality flagged unittest imported both ways. The line-ending test
shells out to git, which inside the pre-push hook would follow the
exported GIT_DIR; it now runs git without GIT_* variables, proved with
GIT_DIR and GIT_INDEX_FILE pointing at a decoy repository that stays
untouched.
2026-11-15 17:09:25 +00:00

30 lines
971 B
Python

"""Remove a folder that a killed test server may still hold for a moment (#636).
On Windows a virtual environment's ``python.exe`` is a launcher: it starts
the real interpreter as a child process and ends it with itself. Killing the
launcher returns at once, while Windows is still ending that child, which
still has its log file open, so removing the folder at that moment fails with
WinError 32. ``remove_when_released`` waits until the folder can be removed,
up to a bound, and raises the last error after it.
"""
import shutil
import time
RELEASE_TIMEOUT_S = 30
POLL_S = 0.05
def remove_when_released(path: str, timeout: float = RELEASE_TIMEOUT_S) -> None:
deadline = time.monotonic() + timeout
while True:
try:
shutil.rmtree(path)
return
except FileNotFoundError:
return
except PermissionError:
if time.monotonic() >= deadline:
raise
time.sleep(POLL_S)