Tim*_*all 5 python nose nosetests coverage.py python-3.x
我正在使用nose
我的"unittest"测试并且必须nose-cov
包括覆盖率报告.这些都可以正常工作,但我的部分测试需要运行一些代码multiprocessing.Process
.该nose-cov
文件指出,它可以做multiprocessing
,但我不知道如何得到那个工作.
我只是通过运行nosetests
并使用以下代码来运行测试.coveragerc
:
[run]
branch = True
parallel = True
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about missing debug-only code:
def __repr__
#if self\.debug
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
def __main__\(\):
omit =
mainserver/tests/*
Run Code Online (Sandbox Code Playgroud)
我parallel
在".coveragerc"文件中修改了开关.我也试过sitecustomize.py
在我的site-packages目录中添加这样的东西:
import os
import coverage
os.environ['COVERAGE_PROCESS_START']='/sites/metrics_dev/.coveragerc'
coverage.process_startup()
Run Code Online (Sandbox Code Playgroud)
我很确定它仍然无法正常工作,因为"丢失"报告仍显示我知道正在运行的行(它们输出到控制台).我还尝试在运行测试用例之前在我的测试用例文件中添加环境变量,也在shell中添加环境变量.我还尝试在调用的函数中显式调用相同的东西multiprocessing.Process
来启动新进程.
归档时间: |
|
查看次数: |
1633 次 |
最近记录: |