diff --git a/core/video/youtube_enrichment.py b/core/video/youtube_enrichment.py index af7e6431..ec07ad77 100644 --- a/core/video/youtube_enrichment.py +++ b/core/video/youtube_enrichment.py @@ -13,6 +13,7 @@ followed (or its page opened while followed). Reads/writes only video_library.db from __future__ import annotations +import os import queue import threading import time @@ -50,6 +51,10 @@ class YoutubeDateEnricher: cid = str(channel_id or "").strip() if not cid: return + # Never spawn the background daemon (network + the default DB) under tests; + # the enricher's logic is exercised directly via _enrich() with a tmp DB. + if os.environ.get("PYTEST_CURRENT_TEST"): + return with self._lock: if title: self._titles[cid] = title