Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

test(api): make session decorator path assertion platform-agnostic (#39895)

AlexMultiAgenteaa9d877f14f
diff --git a/api/tests/unit_tests/controllers/console/app/test_model_config_api.py b/api/tests/unit_tests/controllers/console/app/test_model_config_api.py
index d95214cf0ac..7201315c98f 100644
--- a/api/tests/unit_tests/controllers/console/app/test_model_config_api.py
+++ b/api/tests/unit_tests/controllers/console/app/test_model_config_api.py
@@ -2,6 +2,7 @@ from __future__ import annotations
import importlib
import json
+import os
from inspect import unwrap
from typing import Never
from unittest.mock import MagicMock
@@ -139,9 +140,13 @@ def test_post_uses_one_session_and_rolls_back_when_signal_fails(
monkeypatch.setattr(model_config_module.app_model_config_was_updated, "send", fail_signal)
method = model_config_module.ModelConfigResource.post
- while not method.__code__.co_filename.endswith("controllers/common/session.py"):
+ while not os.path.normpath(method.__code__.co_filename).endswith(
+ os.path.join("controllers", "common", "session.py")
+ ):
method = method.__wrapped__
- assert method.__wrapped__.__code__.co_filename.endswith("controllers/console/app/wraps.py")
+ assert os.path.normpath(method.__wrapped__.__code__.co_filename).endswith(
+ os.path.join("controllers", "console", "app", "wraps.py")
+ )
api = model_config_module.ModelConfigResource()
with (