zeroshotGPU / tests /test_deployment.py
Arjunvir Singh
Initial commit: zeroshotGPU MVP with full eval surface
db06ffa
import json
import tempfile
import unittest
from pathlib import Path
from zsgdp.cli import main
from zsgdp.deployment import check_huggingface_space
class DeploymentReadinessTests(unittest.TestCase):
def test_space_check_accepts_current_project(self):
report = check_huggingface_space(Path.cwd())
self.assertTrue(report["valid"])
self.assertEqual(report["target"], "huggingface_spaces")
self.assertEqual(report["space_name"], "zeroshotGPU")
self.assertEqual(report["gpu_models_target"], "zeroshotGPU")
self.assertEqual(report["failure_count"], 0)
self.assertTrue(any(check["status"] == "warn" for check in report["checks"]))
def test_space_check_cli_writes_report(self):
with tempfile.TemporaryDirectory() as tmp:
output_path = Path(tmp) / "space_report.json"
code = main(["space-check", "--root", str(Path.cwd()), "--output", str(output_path)])
self.assertEqual(code, 0)
self.assertTrue(output_path.exists())
self.assertTrue(json.loads(output_path.read_text(encoding="utf-8"))["valid"])
def test_space_check_reports_missing_files(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
report = check_huggingface_space(root)
self.assertFalse(report["valid"])
self.assertGreater(report["failure_count"], 0)
self.assertTrue(any(check["id"] == "required_file" and check["status"] == "fail" for check in report["checks"]))
if __name__ == "__main__":
unittest.main()