fix(dsh): address intervention cancellation and verification review
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:
1 parent
de9cb2908d
commit
775bc23dc3
26 files changed
+1280
-119
No files matched your search
@@ -0,0 +1,54 @@
|
||||
from threading import Event
|
||||
|
||||
from dx_productivity.trial_task_center.ui.queries import LatestQuery
|
||||
from dx_productivity.trial_task_center.ui.resource_status import ResourceStatus
|
||||
|
||||
|
||||
def test_active_workers_excludes_cancelled_old_selection_and_is_immutable(qtbot):
|
||||
query = LatestQuery()
|
||||
first_started, second_started, release = Event(), Event(), Event()
|
||||
def read(started):
|
||||
started.set()
|
||||
assert release.wait(5)
|
||||
return ()
|
||||
try:
|
||||
query.request(lambda: read(first_started), lambda _: None, lambda _: None)
|
||||
qtbot.waitUntil(first_started.is_set)
|
||||
first = query.active_workers
|
||||
assert isinstance(first, tuple) and len(first) == 1
|
||||
query.request(lambda: read(second_started), lambda _: None, lambda _: None)
|
||||
qtbot.waitUntil(second_started.is_set)
|
||||
current = query.active_workers
|
||||
assert len(current) == 1 and current[0] is not first[0]
|
||||
query.invalidate()
|
||||
assert query.active_workers == () and len(first) == 1
|
||||
finally:
|
||||
release.set()
|
||||
qtbot.waitUntil(lambda: not query.busy)
|
||||
query.close()
|
||||
|
||||
|
||||
def test_resource_failures_count_actual_callbacks_and_success_resets(qtbot):
|
||||
state = {'fail': True, 'calls': 0}
|
||||
def read():
|
||||
state['calls'] += 1
|
||||
if state['fail']:
|
||||
raise OSError('temporary local file failure')
|
||||
return ()
|
||||
status = ResourceStatus(read)
|
||||
try:
|
||||
assert status.consecutive_failures == 0
|
||||
status.refresh()
|
||||
qtbot.waitUntil(lambda: not status.busy)
|
||||
assert status.consecutive_failures == 1
|
||||
status.changed.emit()
|
||||
assert status.consecutive_failures == 1
|
||||
status.refresh()
|
||||
qtbot.waitUntil(lambda: not status.busy)
|
||||
assert status.consecutive_failures == 2
|
||||
state['fail'] = False
|
||||
status.refresh()
|
||||
qtbot.waitUntil(lambda: not status.busy)
|
||||
assert status.consecutive_failures == 0 and state['calls'] == 3
|
||||
finally:
|
||||
status.close()
|
||||
Reference in new issue
Block a user