mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-19 22:21:04 +08:00
CI: modify testcase to p3 (#17047)
### Summary CI: modify longtime testcase to p3
This commit is contained in:
@@ -271,7 +271,7 @@ def test_chat_delete_error_and_repeat_contract(rest_client, clear_chats):
|
||||
assert f"Chat({chat_id}) not found." in second_payload["message"], second_payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_delete_concurrent_and_bulk_contract(rest_client, clear_chats):
|
||||
concurrent_ids = _reset_chat_batch(rest_client, "delete_concurrent", count=20)
|
||||
with ThreadPoolExecutor(max_workers=5) as executor:
|
||||
@@ -357,7 +357,7 @@ def test_chat_list_keyword_and_invalid_param_contract(rest_client, clear_chats):
|
||||
assert payload["data"]["chats"][0]["name"] == expected_name, (scenario_name, payload)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_list_page_and_page_size_contract(rest_client, clear_chats):
|
||||
cases = [
|
||||
("page none", {"page": None, "page_size": 2}, 0, lambda total: total, ""),
|
||||
@@ -426,7 +426,7 @@ def test_chat_list_sorting_contract(rest_client, clear_chats):
|
||||
assert expected_message in payload["message"], (scenario_name, payload)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_list_concurrent_and_dataset_delete_contract(rest_client, clear_chats, ensure_parsed_document):
|
||||
_reset_chat_batch(rest_client, "list_concurrent")
|
||||
with ThreadPoolExecutor(max_workers=5) as executor:
|
||||
@@ -1456,7 +1456,7 @@ def test_update_chat_allows_knowledge_placeholder_without_sources_unit(monkeypat
|
||||
assert updated["prompt_config"]["system"] == "Answer with {knowledge}"
|
||||
|
||||
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
def test_chat_create_dataset_ids_contract(rest_client, clear_chats, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
cases = [
|
||||
@@ -1495,7 +1495,7 @@ def test_chat_create_avatar_contract(rest_client, clear_chats, tmp_path):
|
||||
assert payload["data"]["icon"] == encoded_avatar, payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_create_llm_contract(rest_client, clear_chats, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
cases = [
|
||||
@@ -1555,7 +1555,7 @@ def test_chat_create_llm_contract(rest_client, clear_chats, ensure_parsed_docume
|
||||
assert body["message"] == expected_message, (scenario_name, body)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_create_prompt_contract(rest_client, clear_chats):
|
||||
cases = [
|
||||
(
|
||||
@@ -1706,7 +1706,7 @@ def test_chat_update_name_contract(rest_client, clear_chats):
|
||||
assert payload["message"] == expected_message, (scenario_name, payload)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_update_dataset_ids_contract(rest_client, clear_chats, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
target_res = rest_client.post("/chats", json={"name": "restful_chat_update_dataset_target", "dataset_ids": []})
|
||||
@@ -1741,7 +1741,7 @@ def test_chat_update_dataset_ids_contract(rest_client, clear_chats, ensure_parse
|
||||
assert payload["message"] == expected_message, (scenario_name, payload)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_update_avatar_contract(rest_client, clear_chats, ensure_parsed_document, tmp_path):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
create_res = rest_client.post("/chats", json={"name": "restful_chat_update_avatar_target", "dataset_ids": []})
|
||||
@@ -1770,7 +1770,7 @@ def test_chat_update_avatar_contract(rest_client, clear_chats, ensure_parsed_doc
|
||||
assert get_payload["data"]["dataset_ids"] == [dataset_id], get_payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_update_llm_contract(rest_client, clear_chats, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
cases = [
|
||||
@@ -1842,7 +1842,7 @@ def test_chat_update_llm_contract(rest_client, clear_chats, ensure_parsed_docume
|
||||
assert body["message"] == expected_message, (scenario_name, body)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_update_prompt_contract(rest_client, clear_chats, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
cases = [
|
||||
|
||||
@@ -354,7 +354,7 @@ def test_chunks_list_empty_document(rest_client, create_document):
|
||||
assert "doc" in list_payload["data"], list_payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chunk_delete_basic_contract(rest_client, create_document):
|
||||
dataset_id, document_id = create_document("chunk_delete_basic.txt")
|
||||
base_path = f"/datasets/{dataset_id}/documents/{document_id}/chunks"
|
||||
@@ -471,7 +471,7 @@ def test_chunk_delete_web_legacy_basic_variants(rest_client, create_document):
|
||||
assert list_payload["data"]["total"] == remaining, (scenario_name, list_payload)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chunk_delete_concurrent_and_bulk_contract(rest_client, create_document):
|
||||
dataset_id, document_id = create_document("chunk_delete_bulk_contract.txt")
|
||||
base_path = f"/datasets/{dataset_id}/documents/{document_id}/chunks"
|
||||
@@ -661,7 +661,7 @@ def test_chunk_update_requires_auth(rest_client, create_document):
|
||||
assert_auth_error(payload, scenario_name)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chunk_update_content_and_available_contract(rest_client, create_document):
|
||||
content_cases = [
|
||||
("content none", {"content": None}, 0, ""),
|
||||
@@ -773,7 +773,7 @@ def test_chunk_update_invalid_target_and_param_contract(rest_client, create_docu
|
||||
assert body["code"] == 0, (scenario_name, body)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chunk_update_repeated_concurrent_and_deleted_document_contract(rest_client, create_document):
|
||||
dataset_id, document_id, chunk_id, base_path = _create_chunk_for_update(rest_client, create_document, "chunk_update_repeated_concurrent_deleted.txt")
|
||||
|
||||
|
||||
@@ -2410,7 +2410,7 @@ def test_dataset_search_endpoint(rest_client, ensure_parsed_document):
|
||||
assert "chunks" in payload["data"], payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
@pytest.mark.parametrize(
|
||||
"payload",
|
||||
[
|
||||
|
||||
@@ -378,7 +378,7 @@ def test_documents_upload_missing_file(rest_client, create_dataset):
|
||||
assert payload["message"] == "No file part!", payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_documents_upload_contract_matrix(rest_client, create_dataset, tmp_path):
|
||||
dataset_id = create_dataset("dataset_upload_contract")
|
||||
|
||||
@@ -1054,7 +1054,7 @@ def test_documents_metadata_update_path(rest_client, create_document):
|
||||
assert payload["data"]["updated"] >= 1, payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_documents_delete_contract_matrix(rest_client, create_dataset, tmp_path):
|
||||
scenarios = [
|
||||
("empty object", lambda ids: {}, 102, "should either provide doc ids or set delete_all(true)", 3),
|
||||
@@ -1162,7 +1162,7 @@ def test_documents_delete_invalid_dataset_partial_duplicate_repeat_and_cross_dat
|
||||
assert other_list_payload["data"]["total"] == 1, other_list_payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_documents_delete_concurrent_and_bulk_contract(rest_client, create_dataset, tmp_path):
|
||||
dataset_id, uploaded_docs = _seed_documents(rest_client, create_dataset, tmp_path, count=60, timeout=120)
|
||||
document_ids = [doc["id"] for doc in uploaded_docs]
|
||||
@@ -1220,7 +1220,7 @@ def test_documents_parse_requires_auth(create_document):
|
||||
assert_auth_error(body, scenario_name)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_documents_parse_contract_matrix(rest_client, create_dataset, tmp_path):
|
||||
scenarios = [
|
||||
("empty ids", lambda ids: {"document_ids": []}, 102, "`document_ids` is required"),
|
||||
@@ -1256,7 +1256,7 @@ def test_documents_parse_contract_matrix(rest_client, create_dataset, tmp_path):
|
||||
assert "Task done" in doc["progress_msg"], (scenario_name, doc)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_documents_parse_invalid_dataset_partial_duplicate_and_repeated(rest_client, create_dataset, tmp_path):
|
||||
dataset_id, uploaded_docs = _seed_documents(rest_client, create_dataset, tmp_path, count=3)
|
||||
doc_ids = [doc["id"] for doc in uploaded_docs]
|
||||
@@ -1303,7 +1303,7 @@ def test_documents_parse_invalid_dataset_partial_duplicate_and_repeated(rest_cli
|
||||
_wait_document_runs(rest_client, dataset_id, doc_ids, expected_run="DONE")
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_documents_parse_chunks_and_scaled_bulk_contract(rest_client, create_dataset, tmp_path):
|
||||
single_dataset_id, single_docs = _seed_documents(rest_client, create_dataset, tmp_path, count=1)
|
||||
single_doc_id = single_docs[0]["id"]
|
||||
@@ -1421,7 +1421,7 @@ def test_documents_stop_parse_contract_matrix(rest_client, create_dataset, tmp_p
|
||||
assert "Can't stop parsing document that has not started or already completed" in repeated_stop_payload["message"], repeated_stop_payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_documents_stop_parse_invalid_dataset_partial_and_scaled_concurrency(rest_client, create_dataset, tmp_path):
|
||||
dataset_id, uploaded_docs = _seed_documents(rest_client, create_dataset, tmp_path, count=25)
|
||||
doc_ids = [doc["id"] for doc in uploaded_docs]
|
||||
@@ -1562,7 +1562,7 @@ def test_documents_download_filetype_repeat_and_concurrent_contract(rest_client,
|
||||
assert compare_by_hash(source_path, downloaded_path), source_path.name
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_documents_table_parser_chat_patterns(rest_client, clear_datasets, tmp_path):
|
||||
create_dataset_res = rest_client.post(
|
||||
"/datasets",
|
||||
|
||||
@@ -97,7 +97,7 @@ def _set_request_json(monkeypatch, module, payload):
|
||||
monkeypatch.setattr(module, "get_request_json", lambda: _AwaitableValue(deepcopy(payload)))
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_add_message_partial_failure_branch(monkeypatch):
|
||||
module = _load_memory_routes_module(monkeypatch)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from test.testcases.restful_api.helpers.client import RestClient
|
||||
from test.testcases.utils import wait_for
|
||||
|
||||
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
def test_dataset_search_rest_endpoint(rest_client, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
res = rest_client.post(
|
||||
@@ -34,7 +34,7 @@ def test_dataset_search_rest_endpoint(rest_client, ensure_parsed_document):
|
||||
assert "chunks" in payload["data"], payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_multi_dataset_search_rest_endpoint(rest_client, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
res = rest_client.post(
|
||||
@@ -47,7 +47,7 @@ def test_multi_dataset_search_rest_endpoint(rest_client, ensure_parsed_document)
|
||||
assert "chunks" in payload["data"], payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_multi_dataset_search_with_metadata_filter(rest_client, ensure_parsed_document):
|
||||
dataset_id, document_id = ensure_parsed_document()
|
||||
meta_res = rest_client.patch(
|
||||
@@ -80,7 +80,7 @@ def test_multi_dataset_search_with_metadata_filter(rest_client, ensure_parsed_do
|
||||
assert "chunks" in payload["data"], payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_retrieval_compatibility_endpoint(rest_client, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
# /api/v1/retrieval is SDK compatibility endpoint registered from chunk_api.py.
|
||||
@@ -163,7 +163,7 @@ def test_retrieval_requires_auth_contract():
|
||||
assert payload["message"] == expected_message, (scenario_name, payload)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_retrieval_page_and_page_size_contract(rest_client, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
cases = [
|
||||
@@ -189,7 +189,7 @@ def test_retrieval_page_and_page_size_contract(rest_client, ensure_parsed_docume
|
||||
assert expected_message in body["message"], (scenario_name, body)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_retrieval_highlight_keyword_and_invalid_params_contract(rest_client, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
|
||||
@@ -272,7 +272,7 @@ def test_retrieval_vector_similarity_and_top_k_contract(rest_client, ensure_pars
|
||||
assert expected_message in body["message"], (scenario_name, body)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_retrieval_document_ids_and_metadata_condition_contract(rest_client, ensure_parsed_document):
|
||||
dataset_id, document_id = ensure_parsed_document()
|
||||
|
||||
@@ -311,7 +311,7 @@ def test_retrieval_document_ids_and_metadata_condition_contract(rest_client, ens
|
||||
assert metadata_condition_payload["data"]["chunks"] == [], metadata_condition_payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_retrieval_rerank_unknown_contract(rest_client, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
res = rest_client.post(
|
||||
@@ -324,7 +324,7 @@ def test_retrieval_rerank_unknown_contract(rest_client, ensure_parsed_document):
|
||||
assert payload["message"], payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_retrieval_concurrent_contract(rest_client, ensure_parsed_document):
|
||||
dataset_id, _ = ensure_parsed_document()
|
||||
payload = {"question": "chunk", "dataset_ids": [dataset_id]}
|
||||
@@ -374,7 +374,7 @@ def test_deleted_chunks_batch_not_in_retrieval_contract(rest_client, create_docu
|
||||
_retrieval_lacks_chunks(rest_client, dataset_id, "BATCH_DELETE_TEST_CHUNK", chunk_ids)
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_related_questions_contract(rest_client, rest_client_noauth):
|
||||
tokens_res = rest_client.get("/system/tokens")
|
||||
assert tokens_res.status_code == 200, tokens_res.text
|
||||
|
||||
@@ -320,7 +320,7 @@ def test_session_delete_error_and_repeat_contract(rest_client, create_chat):
|
||||
assert f"The chat doesn't own the session {session_id}" in second_payload["message"], second_payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_session_delete_concurrent_and_bulk_contract(rest_client, create_chat):
|
||||
concurrent_chat_id, concurrent_sessions = _seed_sessions(rest_client, create_chat, "delete_concurrent", count=20)
|
||||
|
||||
@@ -677,7 +677,7 @@ def test_chat_completion_nonstream_without_chat(rest_client):
|
||||
assert "answer" in completion_payload["data"], completion_payload
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_chat_completion_stream_events(rest_client, create_chat):
|
||||
chat_id = create_chat("restful_completion_stream_chat")
|
||||
stream_res = rest_client.post(
|
||||
|
||||
@@ -23,7 +23,7 @@ from utils.file_utils import create_image_file
|
||||
|
||||
@pytest.mark.usefixtures("clear_chat_assistants")
|
||||
class TestChatAssistantCreate:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
@pytest.mark.usefixtures("add_chunks")
|
||||
@pytest.mark.parametrize(
|
||||
"name, expected_message",
|
||||
|
||||
@@ -28,7 +28,7 @@ class TestChatAssistantsDelete:
|
||||
pytest.param({"ids": ["invalid_id"]}, "Chat(invalid_id) not found.", 5, marks=pytest.mark.p3),
|
||||
pytest.param({"ids": ["\n!?。;!?\"'"]}, """Chat(\n!?。;!?"\') not found.""", 5, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"ids": r[:1]}, "", 4, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"ids": r}, "", 0, marks=pytest.mark.p1),
|
||||
pytest.param(lambda r: {"ids": r}, "", 0, marks=pytest.mark.p3),
|
||||
],
|
||||
)
|
||||
def test_basic_scenarios(self, client, add_chat_assistants_func, payload, expected_message, remaining):
|
||||
@@ -49,7 +49,7 @@ class TestChatAssistantsDelete:
|
||||
assistants = client.list_chats()
|
||||
assert len(assistants) == remaining
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_delete_chats_nonzero_response_raises(self, client, monkeypatch):
|
||||
class _DummyResponse:
|
||||
def json(self):
|
||||
|
||||
@@ -20,7 +20,7 @@ import pytest
|
||||
|
||||
@pytest.mark.usefixtures("add_chat_assistants")
|
||||
class TestChatAssistantsList:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
def test_default(self, client):
|
||||
assistants = client.list_chats()
|
||||
assert len(assistants) == 5
|
||||
|
||||
@@ -22,7 +22,7 @@ from utils.file_utils import create_image_file
|
||||
|
||||
|
||||
class TestChatAssistantUpdate:
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_update_rejects_non_dict(self, add_chat_assistants_func):
|
||||
_, _, chat_assistants = add_chat_assistants_func
|
||||
chat_assistant = chat_assistants[0]
|
||||
@@ -31,7 +31,7 @@ class TestChatAssistantUpdate:
|
||||
chat_assistant.update.__wrapped__(chat_assistant, "bad")
|
||||
assert "`update_message` must be a dict" in str(exception_info.value)
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_update_raises_on_nonzero_response(self, add_chat_assistants_func, monkeypatch):
|
||||
_, _, chat_assistants = add_chat_assistants_func
|
||||
chat_assistant = chat_assistants[0]
|
||||
@@ -46,7 +46,7 @@ class TestChatAssistantUpdate:
|
||||
chat_assistant.update({"name": "error-case"})
|
||||
assert "boom" in str(exception_info.value)
|
||||
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
def test_update_uses_patch_for_partial_payload(self, add_chat_assistants_func, monkeypatch):
|
||||
_, _, chat_assistants = add_chat_assistants_func
|
||||
chat_assistant = chat_assistants[0]
|
||||
|
||||
@@ -89,7 +89,7 @@ class TestAddChunk:
|
||||
chunks = document.list_chunks()
|
||||
assert len(chunks) == chunks_count + 1, str(chunks)
|
||||
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
@pytest.mark.parametrize(
|
||||
"payload, expected_message",
|
||||
[
|
||||
|
||||
@@ -24,7 +24,7 @@ class TestChunksDeletion:
|
||||
"payload",
|
||||
[
|
||||
pytest.param(lambda r: {"ids": ["invalid_id"] + r}, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"ids": r[:1] + ["invalid_id"] + r[1:4]}, marks=pytest.mark.p1),
|
||||
pytest.param(lambda r: {"ids": r[:1] + ["invalid_id"] + r[1:4]}, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"ids": r + ["invalid_id"]}, marks=pytest.mark.p3),
|
||||
],
|
||||
)
|
||||
@@ -92,7 +92,7 @@ class TestChunksDeletion:
|
||||
pytest.param({"ids": ["invalid_id"]}, "rm_chunk deleted chunks 0, expect 1", 5, marks=pytest.mark.p3),
|
||||
pytest.param("not json", "UnboundLocalError", 5, marks=pytest.mark.skip(reason="pull/6376")),
|
||||
pytest.param(lambda r: {"ids": r[:1]}, "", 4, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"ids": r}, "", 1, marks=pytest.mark.p1),
|
||||
pytest.param(lambda r: {"ids": r}, "", 1, marks=pytest.mark.p3),
|
||||
pytest.param({"ids": []}, "", 5, marks=pytest.mark.p3),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ from utils.engine_utils import get_doc_engine
|
||||
|
||||
|
||||
class TestChunksList:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
@pytest.mark.parametrize(
|
||||
"params, expected_page_size, expected_message",
|
||||
[
|
||||
@@ -136,7 +136,7 @@ class TestChunksList:
|
||||
assert len(responses) == count, responses
|
||||
assert all(len(future.result()) == 5 for future in futures)
|
||||
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
def test_default(self, add_document):
|
||||
_, document = add_document
|
||||
batch_add_chunks(document, 31)
|
||||
|
||||
@@ -22,7 +22,7 @@ DOC_ENGINE = (os.getenv("DOC_ENGINE") or "").lower()
|
||||
|
||||
|
||||
class TestChunksRetrieval:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
@pytest.mark.parametrize(
|
||||
"payload, expected_page_size, expected_message",
|
||||
[
|
||||
|
||||
@@ -21,7 +21,7 @@ import pytest
|
||||
|
||||
|
||||
class TestUpdatedChunk:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
@pytest.mark.parametrize(
|
||||
"payload, expected_message",
|
||||
[
|
||||
|
||||
@@ -58,12 +58,12 @@ class TestDocumentsParse:
|
||||
"payload, expected_message",
|
||||
[
|
||||
pytest.param(None, "AttributeError", marks=pytest.mark.skip),
|
||||
pytest.param({"document_ids": []}, "`document_ids` is required", marks=pytest.mark.p1),
|
||||
pytest.param({"document_ids": []}, "`document_ids` is required", marks=pytest.mark.p3),
|
||||
pytest.param({"document_ids": ["invalid_id"]}, "Documents not found: ['invalid_id']", marks=pytest.mark.p3),
|
||||
pytest.param({"document_ids": ["\n!?。;!?\"'"]}, "Documents not found: ['\\n!?。;!?\"\\'']", marks=pytest.mark.p3),
|
||||
pytest.param("not json", "AttributeError", marks=pytest.mark.skip),
|
||||
pytest.param(lambda r: {"document_ids": r[:1]}, "", marks=pytest.mark.p1),
|
||||
pytest.param(lambda r: {"document_ids": r}, "", marks=pytest.mark.p1),
|
||||
pytest.param(lambda r: {"document_ids": r[:1]}, "", marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"document_ids": r}, "", marks=pytest.mark.p3),
|
||||
],
|
||||
)
|
||||
def test_basic_scenarios(self, add_documents_func, payload, expected_message):
|
||||
@@ -84,7 +84,7 @@ class TestDocumentsParse:
|
||||
"payload",
|
||||
[
|
||||
pytest.param(lambda r: {"document_ids": ["invalid_id"] + r}, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"document_ids": r[:1] + ["invalid_id"] + r[1:3]}, marks=pytest.mark.p1),
|
||||
pytest.param(lambda r: {"document_ids": r[:1] + ["invalid_id"] + r[1:3]}, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"document_ids": r + ["invalid_id"]}, marks=pytest.mark.p3),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@ class TestAuthorization:
|
||||
|
||||
@pytest.mark.usefixtures("add_memory_with_5_raw_message_func")
|
||||
class TestForgetMessage:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
def test_forget_message(self, client):
|
||||
memory_id = self.memory_id
|
||||
memory = Memory(client, {"id": memory_id})
|
||||
|
||||
@@ -38,7 +38,7 @@ class TestAuthorization:
|
||||
|
||||
@pytest.mark.usefixtures("add_memory_with_5_raw_message_func")
|
||||
class TestGetRecentMessage:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
def test_get_recent_messages(self, client):
|
||||
memory_id = self.memory_id
|
||||
res = client.get_recent_messages([memory_id])
|
||||
|
||||
@@ -41,7 +41,7 @@ class TestAuthorization:
|
||||
|
||||
@pytest.mark.usefixtures("add_memory_with_5_raw_message_func")
|
||||
class TestMessageList:
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_params_unset(self, client):
|
||||
memory_id = self.memory_id
|
||||
memory = Memory(client, {"id": memory_id})
|
||||
|
||||
@@ -39,7 +39,7 @@ class TestAuthorization:
|
||||
|
||||
@pytest.mark.usefixtures("add_memory_with_5_raw_message_func")
|
||||
class TestUpdateMessageStatus:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
def test_update_to_false(self, client):
|
||||
memory_id = self.memory_id
|
||||
memory = Memory(client, {"id": memory_id})
|
||||
|
||||
@@ -34,7 +34,7 @@ class _DummyStreamResponse:
|
||||
|
||||
@pytest.mark.usefixtures("clear_session_with_chat_assistants")
|
||||
class TestSessionWithChatAssistantCreate:
|
||||
@pytest.mark.p1
|
||||
@pytest.mark.p3
|
||||
@pytest.mark.parametrize(
|
||||
"name, expected_message",
|
||||
[
|
||||
|
||||
@@ -25,7 +25,7 @@ class TestSessionWithChatAssistantDelete:
|
||||
"payload",
|
||||
[
|
||||
pytest.param(lambda r: {"ids": ["invalid_id"] + r}, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"ids": r[:1] + ["invalid_id"] + r[1:5]}, marks=pytest.mark.p1),
|
||||
pytest.param(lambda r: {"ids": r[:1] + ["invalid_id"] + r[1:5]}, marks=pytest.mark.p3),
|
||||
pytest.param(lambda r: {"ids": r + ["invalid_id"]}, marks=pytest.mark.p3),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ def set_tenant_info():
|
||||
|
||||
|
||||
class TestSessionsWithChatAssistantList:
|
||||
@pytest.mark.p2
|
||||
@pytest.mark.p3
|
||||
def test_list_sessions_raises_on_nonzero_response(self, add_sessions_with_chat_assistant, monkeypatch):
|
||||
chat_assistant, _ = add_sessions_with_chat_assistant
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class TestSessionWithChatAssistantUpdate:
|
||||
@pytest.mark.parametrize(
|
||||
"payload, expected_message",
|
||||
[
|
||||
pytest.param({"name": "valid_name"}, "", marks=pytest.mark.p1),
|
||||
pytest.param({"name": "valid_name"}, "", marks=pytest.mark.p3),
|
||||
pytest.param({"name": "a" * (SESSION_WITH_CHAT_NAME_LIMIT + 1)}, "", marks=pytest.mark.skip(reason="issues/")),
|
||||
pytest.param({"name": 1}, "", marks=pytest.mark.skip(reason="issues/")),
|
||||
pytest.param({"name": ""}, "`name` can not be empty.", marks=pytest.mark.p3),
|
||||
|
||||
Reference in New Issue
Block a user