Merge origin/main and preserve readonly AI handling for BOM source failures
Core regression / Python 3.12 core, intervention UI and release configuration (push) Failing after 21s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python 3.12 core, intervention UI and release configuration (pull_request) Failing after 21s
Core regression / JavaScript syntax (pull_request) Successful in 3s
Core regression / Python 3.12 core, intervention UI and release configuration (push) Failing after 21s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python 3.12 core, intervention UI and release configuration (pull_request) Failing after 21s
Core regression / JavaScript syntax (pull_request) Successful in 3s
This commit is contained in:
commit
bd06bbc7d2
45 files changed
+2068
-98
No files matched your search
@@ -31,7 +31,7 @@ def test_bom_validation_reports_original_owner_and_bounded_evidence(ui, blockers
|
||||
panel = ui.window.plan_panel
|
||||
owner = ui.tasks[0].task_id
|
||||
pending = []
|
||||
monkeypatch.setattr(QFileDialog, 'getOpenFileName', lambda *args: ('bad.xlsx', ''))
|
||||
monkeypatch.setattr(QFileDialog, 'getOpenFileNames', lambda *args: (['bad.xlsx'], ''))
|
||||
monkeypatch.setattr(panel, '_dispatch_cancellable', lambda operation, callback, button, **kwargs: pending.append(callback))
|
||||
panel.import_bom()
|
||||
ui.open(ui.tasks[1])
|
||||
@@ -55,10 +55,10 @@ def test_bom_new_attempt_clears_scope_but_cancelled_file_dialog_does_not(ui, blo
|
||||
panel._received_bom_report(report, scope=scope)
|
||||
source = reports(blockers)[-1][1][0]
|
||||
blockers.clear()
|
||||
monkeypatch.setattr(QFileDialog, 'getOpenFileName', lambda *args: ('', ''))
|
||||
monkeypatch.setattr(QFileDialog, 'getOpenFileNames', lambda *args: ([], ''))
|
||||
panel.import_bom()
|
||||
assert not blockers
|
||||
monkeypatch.setattr(QFileDialog, 'getOpenFileName', lambda *args: ('new.xlsx', ''))
|
||||
monkeypatch.setattr(QFileDialog, 'getOpenFileNames', lambda *args: (['new.xlsx'], ''))
|
||||
monkeypatch.setattr(panel, '_dispatch', lambda *args, **kwargs: None)
|
||||
panel.import_bom()
|
||||
assert ('clear', (source,), {}) in blockers
|
||||
@@ -182,6 +182,44 @@ def test_bom_operational_report_and_progress_keep_import_owner_after_selection_c
|
||||
assert not ui.calls
|
||||
|
||||
|
||||
@pytest.mark.parametrize('code', ['bom_import', 'project_binding'])
|
||||
def test_bom_source_failure_without_report_keeps_readonly_scope_and_original_owner(ui, blockers, monkeypatch, code):
|
||||
window = ui.window
|
||||
panel = window.plan_panel
|
||||
owner = panel.task_id
|
||||
scope = panel._report_scope(owner)
|
||||
window._dsh_authorized_tasks.add(owner)
|
||||
window._dsh_run_id = 'previous-authorized-execution'
|
||||
monkeypatch.setattr(panel, '_dispatch', lambda *args, **kwargs: None)
|
||||
panel._dispatch_cancellable(lambda *args: None, lambda _: None, panel.import_bom_button, bom_scope=scope)
|
||||
ui.open(ui.tasks[1])
|
||||
monkeypatch.setattr(window, '_queue_dsh_incident', lambda *a: pytest.fail('BOM failure must not inherit CAD authorization'))
|
||||
error = TaskCenterError(code, 'Source workbook validation failed')
|
||||
window._show_error(error, owner_task_id=owner, operation_area='bom')
|
||||
assert not reports(blockers)
|
||||
panel.finish_operation(error=error)
|
||||
args, options = reports(blockers)[-1][1:]
|
||||
assert args[1:3] == (owner, code)
|
||||
assert args[4]['scope'] == list(scope)
|
||||
assert options['read_only'] is True
|
||||
assert panel.bom_import_state.report is None
|
||||
assert not ui.calls
|
||||
|
||||
|
||||
def test_unrelated_query_error_during_bom_import_keeps_its_own_incident(ui, blockers, monkeypatch):
|
||||
window = ui.window
|
||||
panel = window.plan_panel
|
||||
queued = []
|
||||
monkeypatch.setattr(panel, '_dispatch', lambda *args, **kwargs: None)
|
||||
panel._dispatch_cancellable(lambda *args: None, lambda _: None, panel.import_bom_button,
|
||||
bom_scope=panel._report_scope(panel.task_id))
|
||||
monkeypatch.setattr(window, '_queue_dsh_incident', lambda *args: queued.append(args) or True)
|
||||
window._show_error(TaskCenterError('task_read_failed', 'Unrelated task list read failed'))
|
||||
assert len(queued) == 1 and queued[0][1] == 'task_read_failed'
|
||||
assert not reports(blockers)
|
||||
panel.finish_operation(error=TaskCenterError('operation_cancelled', 'test cleanup'))
|
||||
|
||||
|
||||
def test_lifecycle_direct_rejection_is_reported_once(ui, blockers, monkeypatch):
|
||||
setup_view(ui, monkeypatch)
|
||||
ctl = ui.window._dsh_lifecycle
|
||||
|
||||
@@ -21,6 +21,57 @@ def test_mapping_dialog_exposes_custom_value_nc_and_optional_cell(qtbot):
|
||||
assert dialog.target_cell=='' and '可选' in dialog.cell_combo.itemText(0)
|
||||
|
||||
|
||||
def test_target_table_exposes_item_value_mode_selector(qtbot):
|
||||
from pathlib import Path
|
||||
from dx_productivity.trial_task_center.target_plan import ComponentTarget, TargetPlanRow
|
||||
from dx_productivity.trial_task_center.ui.target_table import TargetTable
|
||||
|
||||
table = TargetTable()
|
||||
qtbot.addWidget(table)
|
||||
row = TargetPlanRow(ComponentTarget(Path('C:/board.prj'), 'MAIN', '1', 'u1', 'R1', 'OLD', '10nF'),
|
||||
True, 'NEW')
|
||||
table.populate((row,))
|
||||
assert table.model().index(0, 10).data() == 'inherit'
|
||||
assert table.model().setData(table.model().index(0, 10), 'part_label')
|
||||
assert table.rows()[0].value_mode == 'part_label'
|
||||
assert not table.rows()[0].custom_value_enabled
|
||||
assert table.model().setData(table.model().index(0, 10), 'custom')
|
||||
assert table.rows()[0].value_mode == 'custom' and table.rows()[0].custom_value_enabled
|
||||
|
||||
from PySide6.QtCore import Qt
|
||||
assert table.model().setData(table.model().index(0, 7), Qt.CheckState.Unchecked,
|
||||
Qt.ItemDataRole.CheckStateRole)
|
||||
assert table.rows()[0].value_mode == 'inherit' and not table.rows()[0].custom_value_enabled
|
||||
assert table.plan_model.headerData(10, Qt.Orientation.Horizontal, Qt.ItemDataRole.ToolTipRole)
|
||||
|
||||
|
||||
def test_target_value_editor_commits_selection_and_escape_cancels(qtbot):
|
||||
from pathlib import Path
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QComboBox
|
||||
from dx_productivity.trial_task_center.target_plan import ComponentTarget, TargetPlanRow
|
||||
from dx_productivity.trial_task_center.ui.target_table import TargetTable
|
||||
|
||||
table = TargetTable()
|
||||
qtbot.addWidget(table)
|
||||
table.resize(1400, 200)
|
||||
table.populate((TargetPlanRow(ComponentTarget(Path('C:/board.prj'), 'MAIN', '1', 'u1',
|
||||
'R1', 'OLD', '10nF'), True, 'NEW'),))
|
||||
table.show()
|
||||
index = table.model().index(0, 10)
|
||||
table.edit(index)
|
||||
editor = table.findChild(QComboBox)
|
||||
assert editor.currentText() == 'inherit'
|
||||
editor.setCurrentText('part_number')
|
||||
qtbot.keyClick(editor, Qt.Key.Key_Tab)
|
||||
assert table.rows()[0].value_mode == 'part_number'
|
||||
table.edit(index)
|
||||
editor = next(e for e in table.findChildren(QComboBox) if e.isVisible())
|
||||
editor.setCurrentText('custom')
|
||||
qtbot.keyClick(editor, Qt.Key.Key_Escape)
|
||||
assert table.rows()[0].value_mode == 'part_number'
|
||||
|
||||
|
||||
def test_small_window_keeps_splitters_and_opens_log_in_disposable_window(ui,qtbot):
|
||||
w=ui.window;w.resize(980,700);qtbot.wait(30)
|
||||
assert w.width()==980 and w.height()==700
|
||||
|
||||
Reference in new issue
Block a user