您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 delete_dataset
  18. from libs.utils.file_utils import (
  19. create_docx_file,
  20. create_eml_file,
  21. create_excel_file,
  22. create_html_file,
  23. create_image_file,
  24. create_json_file,
  25. create_md_file,
  26. create_pdf_file,
  27. create_ppt_file,
  28. create_txt_file,
  29. )
  30. @pytest.fixture(scope="function", autouse=True)
  31. def clear_datasets(get_http_api_auth):
  32. yield
  33. delete_dataset(get_http_api_auth)
  34. @pytest.fixture
  35. def generate_test_files(tmp_path):
  36. files = {}
  37. files["docx"] = tmp_path / "ragflow_test.docx"
  38. create_docx_file(files["docx"])
  39. files["excel"] = tmp_path / "ragflow_test.xlsx"
  40. create_excel_file(files["excel"])
  41. files["ppt"] = tmp_path / "ragflow_test.pptx"
  42. create_ppt_file(files["ppt"])
  43. files["image"] = tmp_path / "ragflow_test.png"
  44. create_image_file(files["image"])
  45. files["pdf"] = tmp_path / "ragflow_test.pdf"
  46. create_pdf_file(files["pdf"])
  47. files["txt"] = tmp_path / "ragflow_test.txt"
  48. create_txt_file(files["txt"])
  49. files["md"] = tmp_path / "ragflow_test.md"
  50. create_md_file(files["md"])
  51. files["json"] = tmp_path / "ragflow_test.json"
  52. create_json_file(files["json"])
  53. files["eml"] = tmp_path / "ragflow_test.eml"
  54. create_eml_file(files["eml"])
  55. files["html"] = tmp_path / "ragflow_test.html"
  56. create_html_file(files["html"])
  57. return files