Grotti 2.0.0: eigenes Repo, Umbenennung von Farm.

This commit is contained in:
Dominic Gundel committed 2026-10-15 08:45:56 +02:00
commit b2e6443c68
69 files changed
+18719

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
"""Zustandsmaschine der Druckwarteschlange mit Fake-Moonraker."""
import unittest
from pathlib import Path
import sys
from unittest import mock
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
from grotti.print_queue import PRINT_START_TIMEOUT_S, PrintQueueDispatcher, _cool_wait_text
class CoolTextTests(unittest.TestCase):
def test_wait_text(self):
cool = {"bed_max": 30, "nozzle_max": 45}
text = _cool_wait_text({"bed": 40, "nozzle": 50}, cool)
self.assertIn("Düse", text)
self.assertIn("Bett", text)
self.assertNotIn(" · ", text)
class DispatcherHelpers(unittest.TestCase):
def test_timeout_constant(self):
self.assertGreaterEqual(PRINT_START_TIMEOUT_S, 300)
def test_worker_busy_empty(self):
d = PrintQueueDispatcher("postgresql://x", {}, watcher=None)
self.assertFalse(d._worker_busy(1))
def test_auto_enabled_default(self):
d = PrintQueueDispatcher("postgresql://x", {}, watcher=None)
self.assertTrue(d._auto_enabled())
d.cfg = {"auto_queue": False}
self.assertFalse(d._auto_enabled())
class ResolveSpoolTests(unittest.TestCase):
def test_material_match(self):
from grotti.jobs import assert_material_match
from grotti.errors import GrottiError
file_row = {"filaments": [{"type": "PLA"}]}
assert_material_match(file_row, [{"material_type": "PLA"}])
with self.assertRaises(GrottiError):
assert_material_match(file_row, [{"material_type": "PETG"}])
if __name__ == "__main__":
unittest.main()