fix: release completed attempts before later failures
This commit is contained in:
1 parent
f0a0131aac
commit
5ed8444d5d
6 files changed
+81
-7
No files matched your search
@@ -165,6 +165,24 @@ def test_two_projects_reuse_cad_and_produce_distinct_close_checkpoints(tmp_path,
|
||||
assert Cad.created[0].closed and Desktop.created[0].released
|
||||
|
||||
|
||||
def test_completed_project_does_not_hold_resolution_wait_for_next_project_failure(tmp_path, monkeypatch):
|
||||
import subprocess
|
||||
command, _ = command_for(tmp_path)
|
||||
next_command, _ = command_for(tmp_path, 'next')
|
||||
runtime = worker_runtime(tmp_path, monkeypatch, lambda command, *a, **k:
|
||||
subprocess.CompletedProcess(command, 0, '', ''))
|
||||
with runtime:
|
||||
runtime.run_worker(command, 5)
|
||||
assert runtime._active_attempts == []
|
||||
def fail_prepare(*args, **kwargs):
|
||||
raise OSError('next project backup failed')
|
||||
monkeypatch.setattr(runtime, '_prepare_attempts', fail_prepare)
|
||||
with pytest.raises(OSError, match='next project backup failed'):
|
||||
runtime.run_worker(next_command, 5)
|
||||
assert not getattr(runtime.stop_event, 'waiting_for_resolution', False)
|
||||
assert not (Path(command[3]) / 'quick-run' / 'uncertain.flag').exists()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('second_fails', [False, True])
|
||||
def test_prewrite_failure_releases_old_desktop_and_retries_only_once(tmp_path, monkeypatch, second_fails):
|
||||
import subprocess
|
||||
|
||||
Reference in new issue
Block a user