34 lines
877 B
Python
34 lines
877 B
Python
# -*- coding: utf-8 -*-
|
|
"""配置中心测试"""
|
|
import sys
|
|
from pathlib import Path
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
|
|
def test_config_paths():
|
|
from config.config import ROOT, LOG_DIR, RESULTS_DIR, CONFIG_DIR
|
|
assert ROOT.exists()
|
|
assert ROOT.is_dir()
|
|
assert (ROOT / "config").samefile(CONFIG_DIR)
|
|
assert LOG_DIR == ROOT / "logs"
|
|
print("config paths OK")
|
|
|
|
|
|
def test_config_values():
|
|
from config.config import (
|
|
IMAGE_QUEUE_MAX_CONCURRENT,
|
|
IMAGE_QUEUE_MAX_SIZE,
|
|
LOG_MAX_BYTES,
|
|
LOG_BACKUP_COUNT,
|
|
)
|
|
assert IMAGE_QUEUE_MAX_CONCURRENT >= 1
|
|
assert IMAGE_QUEUE_MAX_SIZE >= 1
|
|
assert LOG_MAX_BYTES > 0
|
|
assert LOG_BACKUP_COUNT >= 1
|
|
print("config values OK")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_config_paths()
|
|
test_config_values()
|
|
print("All config tests passed")
|