78 lines
1.6 KiB
INI
78 lines
1.6 KiB
INI
[tool:pytest]
|
|
# pytest 配置文件
|
|
|
|
# 测试发现
|
|
testpaths = tests
|
|
python_files = test_*.py *_test.py
|
|
python_classes = Test*
|
|
python_functions = test_*
|
|
|
|
# 输出配置
|
|
addopts =
|
|
-v
|
|
--tb=short
|
|
--strict-markers
|
|
--disable-warnings
|
|
--color=yes
|
|
--durations=10
|
|
--cov=.
|
|
--cov-report=html:htmlcov
|
|
--cov-report=term-missing
|
|
--cov-fail-under=80
|
|
|
|
# 标记定义
|
|
markers =
|
|
slow: marks tests as slow (deselect with '-m "not slow"')
|
|
integration: marks tests as integration tests
|
|
unit: marks tests as unit tests
|
|
api: marks tests as API tests
|
|
database: marks tests as database tests
|
|
device: marks tests as device tests
|
|
analysis: marks tests as analysis tests
|
|
|
|
# 过滤警告
|
|
filterwarnings =
|
|
ignore::UserWarning
|
|
ignore::DeprecationWarning
|
|
ignore::PendingDeprecationWarning
|
|
ignore:.*:pytest.PytestUnraisableExceptionWarning
|
|
|
|
# 最小版本要求
|
|
minversion = 6.0
|
|
|
|
# 测试目录
|
|
testmon_datafile = .testmondata
|
|
|
|
# 日志配置
|
|
log_cli = true
|
|
log_cli_level = INFO
|
|
log_cli_format = %(asctime)s [%(levelname)8s] %(name)s: %(message)s
|
|
log_cli_date_format = %Y-%m-%d %H:%M:%S
|
|
|
|
# 覆盖率配置
|
|
[coverage:run]
|
|
source = .
|
|
omit =
|
|
*/tests/*
|
|
*/venv/*
|
|
*/env/*
|
|
*/__pycache__/*
|
|
*/migrations/*
|
|
setup.py
|
|
conftest.py
|
|
|
|
[coverage:report]
|
|
exclude_lines =
|
|
pragma: no cover
|
|
def __repr__
|
|
if self.debug:
|
|
if settings.DEBUG
|
|
raise AssertionError
|
|
raise NotImplementedError
|
|
if 0:
|
|
if __name__ == .__main__.:
|
|
class .*\bProtocol\):
|
|
@(abc\.)?abstractmethod
|
|
|
|
[coverage:html]
|
|
directory = htmlcov |