feat: embed native Harness assistant and verify live task model
This commit is contained in:
1 parent
9c508333bb
commit
96227eed2e
29 files changed
+11110
-582
No files matched your search
@@ -0,0 +1,46 @@
|
||||
from PySide6.QtCore import Signal
|
||||
from PySide6.QtWidgets import QWidget
|
||||
|
||||
|
||||
class HarnessView(QWidget):
|
||||
action_requested = Signal(object)
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
self.starts = 0
|
||||
self.binds = []
|
||||
|
||||
def start(self):
|
||||
self.starts += 1
|
||||
|
||||
def bind(self, snapshot, **kwargs):
|
||||
self.binds.append(snapshot)
|
||||
self.context = {'task_id': snapshot.task_id, 'revision': 'rev'}
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def test_menu_opens_embedded_harness_and_returns_without_losing_task(ui, monkeypatch):
|
||||
window = ui.window
|
||||
monkeypatch.setattr(type(window), '_create_dsh_view', lambda self: HarnessView(self), raising=False)
|
||||
task_id = window._task_id
|
||||
window.dsh_action.trigger()
|
||||
assert window.content_stack.currentWidget() is window._dsh_view
|
||||
assert window._dsh_view.binds[-1].task_id == task_id
|
||||
assert window._dsh_view.starts == 1
|
||||
window.task_center_action.trigger()
|
||||
assert window.content_stack.currentIndex() == 0
|
||||
assert window._task_id == task_id
|
||||
window.dsh_action.trigger()
|
||||
assert window._dsh_view.starts == 1
|
||||
|
||||
|
||||
def test_cross_task_harness_action_never_reaches_task_service(ui, monkeypatch):
|
||||
window = ui.window
|
||||
monkeypatch.setattr(type(window), '_create_dsh_view', lambda self: HarnessView(self), raising=False)
|
||||
window.dsh_action.trigger()
|
||||
called = []
|
||||
monkeypatch.setattr(window, '_retry_failed', lambda: called.append('retry'))
|
||||
window._handle_dsh_action({'action': 'retry_failed', 'task_id': 'another', 'revision': 'rev'})
|
||||
assert not called
|
||||
Reference in new issue
Block a user