Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio tests: forget the managed provider URL setting cache around each test (#12288)

Daniel Han7b2cb03cece6
diff --git a/studio/backend/tests/conftest.py b/studio/backend/tests/conftest.py
index 2b4d88d4896..ad9859b2fd8 100644
--- a/studio/backend/tests/conftest.py
+++ b/studio/backend/tests/conftest.py
@@ -351,6 +351,26 @@ def _isolate_generation_state():
active_generations.reset_for_tests()
[email protected](autouse = True)
+def _forget_the_managed_provider_url_setting():
+ """Drop the managed-account private provider URL setting's cached answer around each test.
+
+ ``managed_provider_url_settings`` holds the owner's switch for a second so every managed
+ outbound request does not open SQLite. Each test points ``UNSLOTH_STUDIO_HOME`` at a fresh
+ store, but the held answer outlives it: a test that turned the switch on left ``True`` cached,
+ and the next test in the same xdist worker to run inside that second read it instead of its own
+ store's default, so test_managed_account_cannot_list_models_from_a_loopback_provider got a 200
+ with the loopback provider's models where it expected a 400.
+ """
+ settings = sys.modules.get("utils.managed_provider_url_settings")
+ if settings is not None:
+ settings.forget_cached_setting()
+ yield
+ settings = sys.modules.get("utils.managed_provider_url_settings")
+ if settings is not None:
+ settings.forget_cached_setting()
+
+
@pytest.fixture(autouse = True)
def _forget_the_cached_owner_identity():
"""Drop ``process_lifetime``'s cached owner identity after each test.