From a0bb6df2b8cd711cdf68196a163486eb3c72cadd Mon Sep 17 00:00:00 2001 From: Will Miao Date: Mon, 24 Aug 2026 17:23:20 +0800 Subject: [PATCH] test(recipe): reset RecipeScanner singleton in lora availability fixture --- tests/services/test_recipe_lora_availability_filter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/services/test_recipe_lora_availability_filter.py b/tests/services/test_recipe_lora_availability_filter.py index 46a215e0..166118c7 100644 --- a/tests/services/test_recipe_lora_availability_filter.py +++ b/tests/services/test_recipe_lora_availability_filter.py @@ -35,6 +35,9 @@ class StubLoraScanner: @pytest.fixture def recipe_scanner(tmp_path, monkeypatch): + # RecipeScanner is a singleton; reset it so this fixture never receives + # an instance carrying another test module's stub scanner. + RecipeScanner._instance = None monkeypatch.setattr(config, "loras_roots", [str(tmp_path)]) lora_scanner = StubLoraScanner( hashes={"aaa111"}, @@ -80,7 +83,8 @@ def recipe_scanner(tmp_path, monkeypatch): sorted_by_date=recipes, sorted_by_name=recipes, ) - return scanner + yield scanner + RecipeScanner._instance = None async def _fetch_ids(scanner, filters=None):