feat: 未知进度不显示进度条并增加任务详情

This commit is contained in:
2026-10-25 05:46:55 +08:00
parent 4cf64957c5
commit 85e6653da4
5 changed files with 194 additions and 10 deletions
+39
View File
@@ -402,6 +402,45 @@ def test_refresh_saved_session_rewrites_cookie(tmp_path: Path, monkeypatch):
assert stored[0]["cookies"][0]["value"] == "kept"
def test_snapshot_reports_csv_size(tmp_path: Path):
csv_path = tmp_path / "out.csv"
csv_path.write_bytes(b"abcdef")
job = DownloadJob(
id="20260921120009",
directory=tmp_path,
network="NR",
city_code="JM",
city_name="江门",
month="2026-09",
groups=["rsrp"],
concurrency=2,
grid_ids=["1", "2"],
csv_path=csv_path,
created_at="2026-09-21T12:00:09",
whole_city=True,
listing_done=False,
discovered=4,
)
snap = job.snapshot()
assert snap["fileBytes"] == 6
assert snap["listingDone"] is False
assert snap["total"] == 4
missing = DownloadJob(
id="20260921120010",
directory=tmp_path,
network="LTE",
city_code="JM",
city_name="江门",
month="2026-09",
groups=["rsrp"],
concurrency=1,
grid_ids=[],
csv_path=tmp_path / "missing.csv",
created_at="",
)
assert missing.snapshot()["fileBytes"] == 0
def test_task_folder_uses_second_timestamp(tmp_path: Path, monkeypatch):
monkeypatch.setattr(job_module, "DATA_DIR", tmp_path / "jobs")