fix: prove prewrite cancellation and bound recovery metadata lifetime
This commit is contained in:
1 parent
32dcd80d1e
commit
906cfc06be
14 files changed
+659
-60
No files matched your search
@@ -0,0 +1,32 @@
|
||||
from threading import Event,Thread
|
||||
|
||||
from cbb_refresh_verify.operation_queue import QueueCancelled
|
||||
from test_issue15_ui_integration import window_for
|
||||
|
||||
|
||||
def test_actual_global_stop_button_cancels_running_and_same_app_queued_jobs(qtbot,tmp_path,monkeypatch):
|
||||
window=window_for(qtbot,tmp_path,monkeypatch)
|
||||
first=window._new_job('verify',library=tmp_path/'lib.lmc')
|
||||
second=window._new_job('native_session',library=tmp_path/'lib.lmc')
|
||||
entered,release,waiting,done=Event(),Event(),Event(),Event();calls=[];errors=[]
|
||||
def current():
|
||||
calls.append('first');entered.set();release.wait(3)
|
||||
def run_first():
|
||||
try:window.native_queue.run(current,context=first.context,stop=first.context.stop)
|
||||
except QueueCancelled:pass
|
||||
def queued():
|
||||
try:window.native_queue.run(lambda:calls.append('second'),context=second.context,
|
||||
stop=second.context.stop,waiting=waiting.set)
|
||||
except QueueCancelled as error:errors.append(error)
|
||||
finally:done.set()
|
||||
a=Thread(target=run_first);b=Thread(target=queued)
|
||||
a.start();assert entered.wait(2);b.start()
|
||||
try:
|
||||
qtbot.waitUntil(waiting.is_set);window._update()
|
||||
assert window.stop_button.isEnabled()
|
||||
window.stop_button.click()
|
||||
qtbot.waitUntil(done.is_set)
|
||||
assert first.context.stop.is_set() and second.context.stop.is_set()
|
||||
assert calls==['first'] and len(errors)==1
|
||||
finally:
|
||||
release.set();a.join(3);b.join(3)
|
||||
Reference in new issue
Block a user