Add separation profiles with activation and explicit GPU assignment

This commit is contained in:
Mikei386 committed 2026-10-01 20:43:56 +02:00
1 parent 356abbeb9d
commit 932284a831
8 files changed
+82 -8

No files matched your search

+13
View File
@@ -61,4 +61,17 @@ class Tests(unittest.TestCase):
worker=SeparatorTests(root,Mock(),scheduler)
with self.assertRaisesRegex(ValueError,'Steuerung'):worker.start(next(iter(MODELS)),audio(),full=True)
def test_profiles_prefer_5080_and_fixed_device_never_falls_back(self):
with tempfile.TemporaryDirectory() as root:
worker=SeparatorTests(Path(root)/'separator-tests',Mock(),Mock());model=next(iter(MODELS))
fast={'name':'RTX 5080','uuid':'GPU-'+'a'*32,'processes':0,'free_mib':12000}
slow={'name':'RTX 3060','uuid':'GPU-'+'b'*32,'processes':0,'free_mib':11000}
with patch('separator.probe',return_value=[slow,fast]):
self.assertEqual(worker.select_gpu(model)['uuid'],fast['uuid'])
worker.configure(dict(model=model,enabled=True,device=fast['uuid']))
with patch('separator.probe',return_value=[slow,dict(fast,processes=1)]):
with self.assertRaisesRegex(ValueError,'kein stiller Wechsel'):worker.select_gpu(model)
with patch('separator.probe',return_value=[fast]):worker.configure(dict(model=model,enabled=False,device='auto'))
restored=SeparatorTests(Path(root)/'separator-tests',Mock(),Mock())
with self.assertRaisesRegex(ValueError,'deaktiviert'):restored.start(model,audio())
if __name__=='__main__':unittest.main()