fix(task8): delivery cleanliness, line endings, and package target

This commit is contained in:
Atharv1705
2026-11-17 18:36:49 +05:30
parent 9276064d18
commit 51e4b39c33
5 changed files with 68 additions and 8 deletions
+41
View File
@@ -0,0 +1,41 @@
import subprocess
import zipfile
from pathlib import Path
def test_package_target_creates_clean_delivery_zip(tmp_path):
repo_root = Path(__file__).resolve().parent.parent.parent
zip_path = tmp_path / "poona-ams-delivery.zip"
# Run git archive command (matching Makefile package target)
cmd = ["git", "archive", "--format=zip", f"--output={zip_path}", "HEAD"]
res = subprocess.run(cmd, cwd=repo_root, capture_output=True, text=True)
assert res.returncode == 0, f"git archive failed: {res.stderr}"
assert zip_path.exists()
with zipfile.ZipFile(zip_path, "r") as z:
names = z.namelist()
assert len(names) > 0
# Assert no .db database files
db_files = [n for n in names if n.endswith(".db") or n.endswith(".sqlite") or n.endswith(".sqlite3")]
assert db_files == [], f"Delivery archive must not contain SQLite databases: {db_files}"
# Assert no frontend dist/ build files
dist_files = [n for n in names if "dist/" in n or n.startswith("dist/")]
assert dist_files == [], f"Delivery archive must not contain dist/ directory: {dist_files}"
# Assert no __pycache__ or compiled bytecode
pycache_files = [n for n in names if "__pycache__" in n or n.endswith(".pyc")]
assert pycache_files == [], f"Delivery archive must not contain __pycache__: {pycache_files}"
# Assert no node_modules or .venv
vendor_files = [n for n in names if "node_modules/" in n or ".venv/" in n]
assert vendor_files == [], f"Delivery archive must not contain vendor/env files: {vendor_files}"
# Assert essential source files are included
assert "backend/app/main.py" in names
assert "frontend/src/App.tsx" in names
assert "Makefile" in names
assert "README.md" in names
assert ".gitignore" in names