test_cli.py 841 B

12345678910111213141516171819202122232425262728293031
  1. import pytest
  2. import os
  3. from conf import conf
  4. import subprocess
  5. from lib import common
  6. import logging
  7. pdf_res_path = conf.conf["pdf_res_path"]
  8. code_path = conf.conf["code_path"]
  9. pdf_dev_path = conf.conf["pdf_dev_path"]
  10. class TestCli:
  11. def test_pdf_specify_dir(self):
  12. """
  13. 输入pdf和指定目录的模型结果
  14. """
  15. cmd = 'cd %s && export PYTHONPATH=. && find %s -type f -name "*.pdf" | xargs -I{} python magic_pdf/cli/magicpdf.py pdf-command --pdf {}' % (code_path, pdf_dev_path)
  16. logging.info(cmd)
  17. common.check_shell(cmd)
  18. common.count_folders_and_check_contents(pdf_res_path)
  19. def test_pdf_specify_jsonl(self):
  20. """
  21. 输入jsonl
  22. """
  23. cmd = "cd %s && export PYTHONPATH=. && python "
  24. if __name__ == "__main__":
  25. pytest.main()