Files
Strata/terminal/tools/test_gitignore_engine_feed.py
T
Niko1221 cd7f55cded gitignore: the folder of setup's ready-made engine download (engine-feed) is not listed as untracked files (#4231)
From PR #4231 (David Piepgrass; its commit d511ae4c3), author kept. In a git checkout, setup puts the engine it fetches
from the update feed in an engine-feed folder beside the install, and git showed its 705 MB as untracked files. The
folder is added to .gitignore, as engine/, engine-sycl/ and engine-cuda12/ already are. Redone by hand: the PR added one
line for the old layout (/engine-feed/); in 0.2.16 setup.py lives in terminal/, so the line is added for both places
(/terminal/engine-feed/ and /engine-feed/). New test (ours; the PR had none): terminal/tools/test_gitignore_engine_feed.py
asks git (check-ignore) about both paths and about an engine source file; 2 cases fail on the old file and pass with the
change (it skips where there is no git checkout).
2026-11-19 13:12:44 +01:00

32 lines
1.1 KiB
Python

"""The folder setup's ready-made engine download goes to (engine-feed, beside the install: terminal/ in a checkout) is not
reported by git as 705 MB of untracked files (#4231).
python -m unittest tools/test_gitignore_engine_feed.py -v
"""
import shutil
import subprocess
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
GIT = shutil.which("git")
@unittest.skipUnless(GIT and (ROOT / ".git").exists() and (ROOT / ".gitignore").is_file(), "needs a git checkout")
class EngineFeedIsIgnored(unittest.TestCase):
def ignored(self, path: str) -> bool:
r = subprocess.run([GIT, "-C", str(ROOT), "check-ignore", "-q", "--no-index", path], capture_output=True)
return r.returncode == 0
def test_the_download_folder_is_ignored(self):
for path in ("terminal/engine-feed/strata-engine/strata.exe", "engine-feed/strata-engine/strata.exe"):
with self.subTest(path=path):
self.assertTrue(self.ignored(path))
def test_the_engine_sources_are_not(self):
self.assertFalse(self.ignored("engine/src/program/generate.cpp"))
if __name__ == "__main__":
unittest.main()