fix: observe retained sessions without blocking independent libraries
This commit is contained in:
1 parent
6278091f21
commit
cb11624b68
9 files changed
+134
-7
No files matched your search
@@ -1,6 +1,22 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_cli_signal_requests_cooperative_batch_stop(tmp_path, monkeypatch):
|
||||
import signal
|
||||
from cbb_refresh_verify import application, verify_runner
|
||||
library = tmp_path/'center.lmc'
|
||||
library.touch()
|
||||
old = signal.getsignal(signal.SIGINT)
|
||||
def run(requests, *, stop):
|
||||
signal.getsignal(signal.SIGINT)(signal.SIGINT, None)
|
||||
assert stop.is_set()
|
||||
return [verify_runner.VerifyResult('CANCELLED')]
|
||||
monkeypatch.setattr(verify_runner, 'run_batch', run)
|
||||
assert application.main(['--batch-lmc', str(library), '--block', 'A',
|
||||
'--data-root', str(tmp_path/'data')]) == 2
|
||||
assert signal.getsignal(signal.SIGINT) is old
|
||||
|
||||
|
||||
def test_smoke_arguments_exit_zero_and_write_lifecycle_log(tmp_path: Path):
|
||||
import subprocess, sys
|
||||
result = subprocess.run([sys.executable, '-m', 'cbb_refresh_verify', '--smoke-test', '--data-root', str(tmp_path)], timeout=30)
|
||||
|
||||
@@ -76,7 +76,8 @@ def test_restart_shows_unfinished_without_starting_worker(qtbot, tmp_path):
|
||||
adapter = SimpleNamespace(capabilities=lambda: {n: Capability(False, 'disabled') for n in ('add', 'update', 'remove')})
|
||||
window = MainWindow(data_root=tmp_path, management_adapter=adapter)
|
||||
qtbot.addWidget(window)
|
||||
assert '未完成' in window.unfinished_label.text() and not window.busy
|
||||
qtbot.waitUntil(lambda: '未完成' in window.unfinished_label.text())
|
||||
assert not window.busy
|
||||
assert 'Block' in window.output.toPlainText()
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,11 @@ from types import SimpleNamespace
|
||||
import pytest
|
||||
|
||||
|
||||
def test_registered_save_is_not_treated_as_an_idle_hung_client():
|
||||
from cbb_refresh_verify.residual_sessions import force_block_reason
|
||||
assert '保存' in force_block_reason({'runtime_phase': 'NATIVE_CALL'})
|
||||
|
||||
|
||||
OWNERSHIP = {"owner_sid": "S-1-current", "session_id": 1, "force_user_confirmed": True}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,25 @@ from PySide6.QtCore import QTimer
|
||||
from test_ui_filters import load_window
|
||||
|
||||
|
||||
def test_late_lease_callback_does_not_refresh_destroyed_view(qtbot, tmp_path, monkeypatch):
|
||||
import shiboken6
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
entered, release = Event(), Event()
|
||||
def action():
|
||||
entered.set()
|
||||
assert release.wait(3)
|
||||
try:
|
||||
window._lease_action(action)
|
||||
qtbot.waitUntil(entered.is_set)
|
||||
window.cbb_table.deleteLater()
|
||||
qtbot.waitUntil(lambda: not shiboken6.isValid(window.cbb_table))
|
||||
release.set()
|
||||
qtbot.waitUntil(lambda: window._lease_pending == 0)
|
||||
finally:
|
||||
release.set()
|
||||
window.pool.waitForDone(3000)
|
||||
|
||||
|
||||
def slow_lease(main_thread):
|
||||
entered, release, closed = Event(), Event(), Event()
|
||||
calls = []
|
||||
|
||||
Reference in new issue
Block a user