- Introduced a new `.coverage` file for tracking test coverage metrics. - Added `pytest.ini` configuration for streamlined testing setup, including coverage reporting and logging options. - Created `requirements-test.txt` to manage testing dependencies, ensuring a consistent testing environment. - Implemented a `run_tests.py` script to facilitate running tests with various options, including unit and integration tests. - Established a structured testing directory with unit and integration tests, enhancing code reliability and maintainability. - Updated documentation to reflect new testing procedures and configurations.
34 lines
919 B
Python
34 lines
919 B
Python
"""
|
|
path_config模块测试
|
|
"""
|
|
|
|
import os
|
|
import pytest
|
|
from pathlib import Path
|
|
import path_config
|
|
|
|
|
|
class TestPathConfig:
|
|
"""路径配置测试类"""
|
|
|
|
def test_get_screenshot_path(self):
|
|
"""测试获取截图路径"""
|
|
path = path_config.get_screenshot_path()
|
|
assert path is not None
|
|
assert isinstance(path, str)
|
|
assert path.endswith(".png") or path.endswith("screenshot.png")
|
|
|
|
def test_get_pic_dir(self):
|
|
"""测试获取图片目录"""
|
|
pic_dir = path_config.get_pic_dir()
|
|
assert pic_dir is not None
|
|
assert isinstance(pic_dir, str)
|
|
assert os.path.isabs(pic_dir) or pic_dir.startswith("pic")
|
|
|
|
def test_paths_exist_or_creatable(self, temp_dir):
|
|
"""测试路径可以创建"""
|
|
# 这个测试需要确保路径可以创建
|
|
# 实际测试中可能需要mock文件系统操作
|
|
pass
|
|
|