feat: 任务可调并发、可批量操作,导航栏可收缩

This commit is contained in:
2026-10-25 08:22:32 +08:00
parent 6a230ee8d4
commit 5f3bb312b3
10 changed files with 375 additions and 56 deletions
+28
View File
@@ -588,6 +588,34 @@ async def _pause_holds_the_next_grid(tmp_path: Path):
assert job.status == "done"
def test_concurrency_waits_until_resume(tmp_path: Path, monkeypatch):
monkeypatch.setattr(job_module, "DATA_DIR", tmp_path / "jobs")
manager = JobManager()
manager.max_concurrent = 2
job = _make_job(manager, None)
job.status = "running"
job.applied_concurrency = 4
class Alive:
def done(self):
return False
job.task = Alive()
try:
manager.set_concurrency(job, 8)
except NqiError as exc:
assert "暂停" in str(exc)
else:
raise AssertionError("下载中不应直接改并发")
manager.pause(job)
manager.set_concurrency(job, 12)
assert job.concurrency == 12
assert job.status == "paused"
assert manager.place(job) == "resume"
assert job.retune.is_set()
assert job.status == "running"
def _make_job(manager: JobManager, output: Path | None) -> DownloadJob:
return manager.create(
network="NR",