fix: isolate component failures and recover owned CAD resources
This commit is contained in:
1 parent
a8da30aad2
commit
4db5f05531
87 files changed
+6688
-301
No files matched your search
@@ -0,0 +1,38 @@
|
||||
def test_owned_modal_can_be_handled_while_execution_worker_is_busy(ui, monkeypatch):
|
||||
window = ui.window
|
||||
ui.settle()
|
||||
worker = object()
|
||||
invoked = []
|
||||
monkeypatch.setattr('dx_productivity.trial_task_center.ui.cad_dialog_operations.show_cad_dialogs',
|
||||
lambda current: invoked.append(current))
|
||||
window.service._supervisor_dialog_state = {'supervision': {'blocked': True}}
|
||||
window._workers.add(worker)
|
||||
try:
|
||||
window._update_gates()
|
||||
button = window.run_panel.cleanup_resources_button
|
||||
assert not button.isHidden() and button.isEnabled()
|
||||
button.click()
|
||||
assert invoked == [window]
|
||||
finally:
|
||||
window._workers.discard(worker)
|
||||
window.service._supervisor_dialog_state = None
|
||||
window._update_gates()
|
||||
|
||||
|
||||
def test_retained_resource_force_requires_explicit_operator_choice(ui, monkeypatch):
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
window = ui.window
|
||||
ui.settle()
|
||||
forced = []
|
||||
monkeypatch.setattr(window.service, 'cleanup_batch_resources', lambda: ({'state': 'blocked'},))
|
||||
monkeypatch.setattr(window.service, 'force_pending_owned_resources',
|
||||
lambda *, confirmed=False: forced.append(confirmed) or ())
|
||||
monkeypatch.setattr(window, '_run_async', lambda action, done, *_a, **_k: done(action()))
|
||||
monkeypatch.setattr(QMessageBox, 'question', lambda *_a, **_k: QMessageBox.StandardButton.No)
|
||||
window.run_panel.cleanup_resources_button.setEnabled(True)
|
||||
window._cleanup_batch_resources()
|
||||
assert forced == []
|
||||
monkeypatch.setattr(QMessageBox, 'question', lambda *_a, **_k: QMessageBox.StandardButton.Yes)
|
||||
window.run_panel.cleanup_resources_button.setEnabled(True)
|
||||
window._cleanup_batch_resources()
|
||||
assert forced == [True]
|
||||
Reference in new issue
Block a user