Files
dxdesigner-part-replacement/tests/ui/test_nonblocking_controls.py
T
阿白叔 b544d92702
Core regression / Python core, intervention UI and release configuration (pull_request) Canceled after 0s
Core regression / JavaScript syntax (pull_request) Canceled after 0s
Core regression / Python core, intervention UI and release configuration (push) Canceled after 1m15s
Core regression / JavaScript syntax (push) Canceled after 0s
fix(dsh): bound local readiness retries and isolate runtime tests
2026-11-09 14:04:53 +08:00

43 lines
1.9 KiB
Python

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 ())
def run_async(action, done, *_a, on_finished=None, **_k):
done(action())
if on_finished is not None:
on_finished()
monkeypatch.setattr(window, '_run_async', run_async)
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]