Config.py 638 B

123456789101112131415161718
  1. import logging
  2. from pathlib import Path
  3. class Config(object):
  4. log_level = logging.DEBUG
  5. log_format = '%(asctime)s - %(name)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s'
  6. # 基础路径配置
  7. BASE_DIR = Path(__file__).resolve().parent.parent
  8. # 测试相关配置
  9. TESTS_DIR = BASE_DIR / "Tests"
  10. ALLURE_RESULTS_DIR = BASE_DIR / "Reports" / "allure-results"
  11. ALLURE_REPORT_DIR = BASE_DIR / "Reports" / "allure-report"
  12. REPORT_ARCHIVE_DIR = BASE_DIR / "Reports" / "archives"
  13. # 确保目录存在
  14. for directory in [ALLURE_RESULTS_DIR, ALLURE_REPORT_DIR, REPORT_ARCHIVE_DIR]:
  15. directory.mkdir(parents=True, exist_ok=True)