89ebb6c61e
release / release (push) Successful in 14s
CPU, GPU (model/driver/VBIOS/VRAM/PCIe), motherboard/BIOS, RAM (total + modules), storage (real disks only), kernel, and display server. - core/inventory.py: collect() + Markdown/JSON/text renderers + dict round-trip; stdlib + nvidia-smi/lspci/lsblk/dmidecode, all degrading gracefully - cli: `rigdoctor inventory` (--json / --markdown / -o) - gui: Inventory tab (fills the last empty tab) with Copy-as-Markdown, Save, and "Run with admin" (pkexec) for dmidecode board/BIOS/RAM details - tests for collect/render/round-trip; remove unused placeholder-page helper Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
"""Tests for the M5 system inventory (render + dict round-trip; collect on real system)."""
|
|
|
|
import unittest
|
|
|
|
from rigdoctor.core import inventory
|
|
from rigdoctor.core.inventory import Section
|
|
|
|
|
|
class InventoryTests(unittest.TestCase):
|
|
def test_collect_returns_sections(self):
|
|
sections = inventory.collect()
|
|
self.assertTrue(sections)
|
|
titles = {s.title for s in sections}
|
|
self.assertIn("System", titles)
|
|
self.assertIn("CPU", titles)
|
|
|
|
def test_dict_round_trip(self):
|
|
sections = [Section("System", [("Kernel", "7.0.0"), ("Distro", "Ubuntu")])]
|
|
restored = inventory.from_dict(inventory.to_dict(sections))
|
|
self.assertEqual(restored[0].title, "System")
|
|
self.assertEqual(restored[0].items, [("Kernel", "7.0.0"), ("Distro", "Ubuntu")])
|
|
|
|
def test_render_markdown(self):
|
|
md = inventory.render_markdown([Section("CPU", [("Model", "Test CPU")])])
|
|
self.assertIn("## CPU", md)
|
|
self.assertIn("- **Model:** Test CPU", md)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|