feat: add Android task file evidence and finalize plugin design
This commit is contained in:
1 parent
96fedc816f
commit
72ff342605
20 files changed
+1005
-35
No files matched your search
@@ -7,6 +7,7 @@ import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
import threading
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -35,8 +36,12 @@ def test_running_state_recovers_from_temporary_windows_file_access(tmp_path, mon
|
||||
raise _windows_access_error(winerror)
|
||||
return replace(source, target)
|
||||
|
||||
monkeypatch.setattr(task_control.os, "replace", busy_replace)
|
||||
monkeypatch.setattr(task_control.time, "sleep", delays.append)
|
||||
monkeypatch.setattr(
|
||||
task_control, "os", SimpleNamespace(**{**vars(task_control.os), "replace": busy_replace})
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
task_control, "time", SimpleNamespace(**{**vars(task_control.time), "sleep": delays.append})
|
||||
)
|
||||
task_control.TaskControl("task-123", object())._state("running")
|
||||
|
||||
assert task_control.read_state("task-123")["status"] == "running"
|
||||
@@ -55,8 +60,12 @@ def test_persistent_windows_access_error_is_bounded_and_preserves_old_state(tmp_
|
||||
attempts.append(source)
|
||||
raise error
|
||||
|
||||
monkeypatch.setattr(task_control.os, "replace", denied_replace)
|
||||
monkeypatch.setattr(task_control.time, "sleep", delays.append)
|
||||
monkeypatch.setattr(
|
||||
task_control, "os", SimpleNamespace(**{**vars(task_control.os), "replace": denied_replace})
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
task_control, "time", SimpleNamespace(**{**vars(task_control.time), "sleep": delays.append})
|
||||
)
|
||||
with pytest.raises(PermissionError) as raised:
|
||||
task_control._write_atomic(path, {"status": "running"})
|
||||
|
||||
@@ -82,8 +91,12 @@ def test_unrelated_file_errors_fail_without_retry_and_clean_temporary_file(
|
||||
attempts.append(source)
|
||||
raise error
|
||||
|
||||
monkeypatch.setattr(task_control.os, "replace", failed_replace)
|
||||
monkeypatch.setattr(task_control.time, "sleep", delays.append)
|
||||
monkeypatch.setattr(
|
||||
task_control, "os", SimpleNamespace(**{**vars(task_control.os), "replace": failed_replace})
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
task_control, "time", SimpleNamespace(**{**vars(task_control.time), "sleep": delays.append})
|
||||
)
|
||||
with pytest.raises(OSError) as raised:
|
||||
task_control._write_atomic(path, {"status": "running"})
|
||||
|
||||
@@ -127,7 +140,9 @@ def test_busy_temporary_cleanup_preserves_original_write_error(tmp_path, monkeyp
|
||||
raise _windows_access_error(32)
|
||||
return unlink(target, **kwargs)
|
||||
|
||||
monkeypatch.setattr(task_control.os, "replace", failed_replace)
|
||||
monkeypatch.setattr(
|
||||
task_control, "os", SimpleNamespace(**{**vars(task_control.os), "replace": failed_replace})
|
||||
)
|
||||
monkeypatch.setattr(Path, "unlink", busy_unlink)
|
||||
monkeypatch.setattr(task_control.time, "sleep", lambda _: None)
|
||||
try:
|
||||
@@ -163,7 +178,9 @@ def test_repeated_control_requests_recover_from_file_sharing(
|
||||
raise _windows_access_error(32)
|
||||
return replace(source, target)
|
||||
|
||||
monkeypatch.setattr(task_control.os, "replace", busy_replace)
|
||||
monkeypatch.setattr(
|
||||
task_control, "os", SimpleNamespace(**{**vars(task_control.os), "replace": busy_replace})
|
||||
)
|
||||
monkeypatch.setattr(task_control.time, "sleep", lambda _: None)
|
||||
send_request("task-123")
|
||||
|
||||
|
||||
Reference in new issue
Block a user