Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

conftest.py 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # Copyright 2025 The InfiniFlow Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. import pytest
  17. from common import batch_add_sessions_with_chat_assistant, delete_session_with_chat_assistants
  18. @pytest.fixture(scope="class")
  19. def add_sessions_with_chat_assistant(request, HttpApiAuth, add_chat_assistants):
  20. def cleanup():
  21. for chat_assistant_id in chat_assistant_ids:
  22. delete_session_with_chat_assistants(HttpApiAuth, chat_assistant_id)
  23. request.addfinalizer(cleanup)
  24. _, _, chat_assistant_ids = add_chat_assistants
  25. return chat_assistant_ids[0], batch_add_sessions_with_chat_assistant(HttpApiAuth, chat_assistant_ids[0], 5)
  26. @pytest.fixture(scope="function")
  27. def add_sessions_with_chat_assistant_func(request, HttpApiAuth, add_chat_assistants):
  28. def cleanup():
  29. for chat_assistant_id in chat_assistant_ids:
  30. delete_session_with_chat_assistants(HttpApiAuth, chat_assistant_id)
  31. request.addfinalizer(cleanup)
  32. _, _, chat_assistant_ids = add_chat_assistants
  33. return chat_assistant_ids[0], batch_add_sessions_with_chat_assistant(HttpApiAuth, chat_assistant_ids[0], 5)