fix: preserve native calls on stop and keep status reads observational

This commit is contained in:
阿白叔 committed 2026-11-06 15:42:33 +08:00
1 parent 97a3de20c9
commit 8d3eab1164
19 files changed
+631 -290

No files matched your search

+6 -5
View File
@@ -111,10 +111,12 @@ def test_reader_does_not_create_desktop_before_preparation_finishes(monkeypatch,
@pytest.mark.parametrize('reader', ['read_library_flag', 'read_library_tree_image_map'])
def test_reader_closes_desktop_when_process_launch_fails(monkeypatch, tmp_path, reader):
def test_reader_never_creates_a_desktop_or_process(monkeypatch, tmp_path, reader):
import win32service
import win32process
import cbb_refresh_verify.mentor_adapter as module
from pywinauto import Desktop
monkeypatch.setattr(Desktop, 'windows', lambda *_: [])
closed = []
@@ -133,11 +135,10 @@ def test_reader_closes_desktop_when_process_launch_fails(monkeypatch, tmp_path,
if reader == 'read_library_flag':
flag, detail = module.read_library_flag(tmp_path / 'library.lmc', 'Block')
assert flag == module.FLAG_UNKNOWN
assert 'launch failed' in detail
assert 'Library Manager' in detail
else:
with pytest.raises(RuntimeError, match='launch failed'):
module.read_library_tree_image_map(tmp_path / 'library.lmc', ['Block'])
assert closed == ['desktop']
assert module.read_library_tree_image_map(tmp_path / 'library.lmc', ['Block']) == {'Block': None}
assert closed == []
def test_constructor_releases_private_desktop_when_process_launch_fails(monkeypatch):