import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import unittest import deckit.modules.stats as stats class Stats(unittest.TestCase): def test_state_shape(self): st = stats.make({}).state() for key in ("cpu", "memUsed", "memTotal", "net", "uptime", "host"): self.assertIn(key, st) self.assertIsInstance(st["cpu"], int) def test_build_discovers_stats(self): from deckit.modules import build names = [m["name"] for m in build({"modules": {}}).names()] self.assertIn("stats", names) if __name__ == "__main__": unittest.main()