fix: allow native inspection and backup entry after batch errors

This commit is contained in:
阿白叔 committed 2026-11-05 08:24:53 +08:00
1 parent aea6192ef9
commit 1acfbd6374
5 files changed
+65 -12

No files matched your search

+17 -4
View File
@@ -154,7 +154,7 @@ def test_busy_or_unknown_inspection_is_not_labelled_as_database_damage(qtbot, tm
assert 'ICDB 问题' not in window.cbb_table.item(window._row_by_name['Beta'], 3).text()
def test_missing_pcb_can_be_checked_without_enabling_verify_or_restore(qtbot, tmp_path, monkeypatch):
def test_missing_pcb_is_skipped_from_icdb_batch_check_and_restore(qtbot, tmp_path, monkeypatch):
from test_ui_filters import load_window
from cbb_refresh_verify.models import CbbRecord
from cbb_refresh_verify.verify_runner import VerifyResult
@@ -163,10 +163,23 @@ def test_missing_pcb_can_be_checked_without_enabling_verify_or_restore(qtbot, tm
records=(CbbRecord('Missing', 'Power', status='PENDING'),),
verifier=lambda req: (calls.append(req.block_name) or VerifyResult('CHECKED')),
status_refresher=lambda names, _: {name: 'PENDING' for name in names})
assert window.icdb_repair_button.isEnabled()
assert not window.icdb_repair_button.isEnabled()
assert not window.batch_button.isEnabled() and not window.backup_restore_button.isEnabled()
window.icdb_repair_button.click(); qtbot.waitUntil(lambda: not window.busy)
assert calls == ['Missing']
assert calls == []
def test_missing_project_rows_are_excluded_from_icdb_batch_check(qtbot, tmp_path, monkeypatch):
from test_ui_filters import load_window
from cbb_refresh_verify.models import CbbRecord
from cbb_refresh_verify.verify_runner import VerifyResult
window = load_window(qtbot, tmp_path, monkeypatch,
records=(CbbRecord('Missing', 'Power', status='PENDING'),
CbbRecord('Good', 'Power', status='PENDING')),
verifier=lambda req: VerifyResult('CHECKED'),
status_refresher=lambda names, _: {name: 'PENDING' for name in names})
window.skipped_names.add('Missing')
window._update()
assert window._maintenance_names() == ['Good']
def test_check_reports_describe_inspection_without_pcb_verification(case, tmp_path):
+10
View File
@@ -136,6 +136,16 @@ def test_native_backup_selection_requires_one_visible_non_ready_item(qtbot, tmp_
window = load_window(qtbot, tmp_path, monkeypatch,
native_backup_launcher=lambda _: pytest.fail('unexpected launch'))
assert not window.native_backup_button.isEnabled()
def test_native_backup_can_use_current_non_ready_row_without_checkbox(qtbot, tmp_path, monkeypatch):
from test_ui_filters import load_window
window = load_window(qtbot, tmp_path, monkeypatch,
native_backup_launcher=lambda _: pytest.fail('unexpected launch'))
row = window._row_by_name['Beta']
window.cbb_table.setCurrentCell(row, 0)
window._update()
assert window.native_backup_button.isEnabled()
window.search_edit.setText('Alpha'); window.select_visible_button.click()
assert not window.native_backup_button.isEnabled()
window.search_edit.clear(); window.select_visible_button.click()
+13
View File
@@ -53,6 +53,19 @@ def test_inspection_mode_only_observes_and_closes_its_tool(tmp_path, monkeypatch
assert actions == [(100, win32con.WM_CLOSE)]
def test_generic_project_backup_shell_is_accepted_as_the_single_target_window(tmp_path, monkeypatch):
import json
from test_native_repair import repair_worker_fixture
ui, root, job, actions = repair_worker_fixture(tmp_path, monkeypatch, 'active')
data = json.loads(job.read_text('utf-8')); data['inspection_only'] = True
job.write_text(json.dumps(data), encoding='utf-8')
monkeypatch.setattr(ui, '_native_output', lambda windows: (
f'Loading project file [{data["project"]}].\nChecking if project is in use.\n'
"Project is not in use. Full iCDB Project Backup's functionality is available.\n"
'Backup information loaded correctly.'))
assert ui.repair_worker_main(job) == 0
def test_only_check_never_counts_as_repair_success():
from cbb_refresh_verify.icdb_maintenance import maintenance_counts
from cbb_refresh_verify.verify_runner import VerifyResult