Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Update test framework (#16875)

Jin Hai13236698a609
diff --git a/test/testcases/restful_api/conftest.py b/test/testcases/restful_api/conftest.py
index 64db36fd70..4afacafbf0 100644
--- a/test/testcases/restful_api/conftest.py
+++ b/test/testcases/restful_api/conftest.py
@@ -255,4 +255,12 @@ def pytest_runtest_protocol(item, nextitem):
start = time.perf_counter()
yield
duration = time.perf_counter() - start
- print(f" [{duration:.3f}s]")
+ if duration >= 10:
+ color = "****" # 4 stars
+ elif duration >= 5:
+ color = "***" # 3 stars
+ elif duration >= 1:
+ color = "**" # 2 stars
+ else:
+ color = ""
+ print(f" {color} [{duration:.3f}s]")
diff --git a/test/testcases/restful_api/test_dify_retrieval_routes_unit.py b/test/testcases/restful_api/test_dify_retrieval_routes_unit.py
index 0f912a7844..be606d95ac 100644
--- a/test/testcases/restful_api/test_dify_retrieval_routes_unit.py
+++ b/test/testcases/restful_api/test_dify_retrieval_routes_unit.py
@@ -256,7 +256,7 @@ def _set_request_json(monkeypatch, module, payload):
monkeypatch.setattr(module, "get_request_json", lambda: _AwaitableValue(deepcopy(payload)))
def test_retrieval_success_with_metadata_and_kg(monkeypatch):
module = _load_dify_retrieval_module(monkeypatch)
_set_request_json(
@@ -307,7 +307,7 @@ def test_retrieval_success_with_metadata_and_kg(monkeypatch):
assert "score" in top, res
def test_retrieval_kb_not_found(monkeypatch):
module = _load_dify_retrieval_module(monkeypatch)
_set_request_json(monkeypatch, module, {"knowledge_id": "kb-missing", "query": "hello"})
diff --git a/test/testcases/restful_api/test_openai_compatible.py b/test/testcases/restful_api/test_openai_compatible.py
index 0f032103d7..b3dbbbd319 100644
--- a/test/testcases/restful_api/test_openai_compatible.py
+++ b/test/testcases/restful_api/test_openai_compatible.py
@@ -148,7 +148,7 @@ def test_openai_compatible_nonstream_shape(rest_client, create_chat):
assert usage["total_tokens"] == usage["prompt_tokens"] + usage["completion_tokens"], usage
def test_openai_compatible_defaults_to_nonstream_when_stream_is_missing(rest_client, create_chat):
chat_id = create_chat("restful_openai_default_nonstream_chat")
res = rest_client.post(
@@ -168,7 +168,7 @@ def test_openai_compatible_defaults_to_nonstream_when_stream_is_missing(rest_cli
assert payload["choices"][0].get("finish_reason") == "stop", payload
def test_openai_compatible_nonstream_with_reference_output_shape(rest_client, create_chat):
chat_id = create_chat("restful_openai_reference_chat")
res = rest_client.post(
@@ -192,7 +192,7 @@ def test_openai_compatible_nonstream_with_reference_output_shape(rest_client, cr
assert isinstance(choice_msg["reference"], list), payload
def test_openai_compatible_stream_shape_and_done_semantics(rest_client, create_chat):
chat_id = create_chat("restful_openai_stream_chat")
res = rest_client.post(