Files
pokemon/tests/update_swarm/test_jobs.py
T

28 lines
1.1 KiB
Python

import os, sys, tempfile, unittest
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
sys.path.insert(0, os.path.join(ROOT, "scripts"))
from update_swarm.jobs import build_jobs, init_run
FIXTURE = os.path.join(os.path.dirname(__file__), "fixtures", "vault", "Pokémon ROM Hacks")
class TestJobs(unittest.TestCase):
def test_flags_watchlist_and_wanted(self):
jobs = {j["stem"]: j for j in build_jobs(FIXTURE)}
self.assertIn("FakeHack", jobs)
self.assertTrue(jobs["FakeHack"]["wanted"])
self.assertFalse(jobs["FakeHack"]["watchlist"])
self.assertEqual(jobs["FakeHack"]["note_version"], "1.0.0")
self.assertTrue(jobs["DemoOnly"]["watchlist"])
self.assertFalse(jobs["DemoOnly"]["wanted"])
self.assertIsNone(jobs["DemoOnly"]["library_path"])
def test_init_run_creates_dirs(self):
with tempfile.TemporaryDirectory() as td:
run = os.path.join(td, "2026-08-14")
init_run(run)
for name in ("census", "scouts", "staging"):
self.assertTrue(os.path.isdir(os.path.join(run, name)))
if __name__ == "__main__":
unittest.main()