Clarify no-download queue failures

This commit is contained in:
Dymas
2026-05-25 23:13:41 +02:00
parent 94ded2725e
commit 1f50c3c666
6 changed files with 37 additions and 4 deletions
+21
View File
@@ -460,6 +460,27 @@ class DownloadQueueWorkerFailureTests(unittest.TestCase):
self.assertEqual(stored["status"], "failed")
self.assertFalse(staging_dir.exists())
def test_zero_exit_without_downloaded_files_marks_job_failed_with_clear_message(self):
queue = APP.DownloadQueue(lambda: {"mode": "sub", "quality": "best", "download_dir": "/tmp/example"}, start_worker=False)
job = queue.add({"query": "Queue Show", "title": "Queue Show", "season": "1", "episodes": "1-10"})
staging_dir = queue_jobs.job_staging_dir(job)
class FakeProc:
pid = 4321
stdout = ["Checking dependencies...\n"]
def wait(self):
return 0
with mock.patch.object(queue_jobs.subprocess, "Popen", return_value=FakeProc()):
queue._run_job(job)
stored = queue._find(job["id"])
self.assertEqual(stored["status"], "failed")
self.assertEqual(stored["exit_code"], 1)
self.assertIn("without downloading any files", "\n".join(stored["log"]))
self.assertFalse(staging_dir.exists())
def test_run_job_marks_post_start_exception_failed_without_killing_worker_state(self):
queue = APP.DownloadQueue(lambda: {"mode": "sub", "quality": "best", "download_dir": "/tmp/example"}, start_worker=False)
job = queue.add({"query": "Queue Show", "title": "Queue Show", "season": "1", "episodes": "1"})