gue*_*tli 10 python pytest python-2.7 xdist python-hunter
我想py.test与hunter结合使用:
PYTHONHUNTER="module_startswith='foo'" py.test -s -k test_bar
Run Code Online (Sandbox Code Playgroud)
不幸的是,hunter的输出(跟踪)不可见。
版:
foo_cok_d@aptguettler:~$ py.test --version
This is pytest version 3.4.2, imported from /home/foo_cok_d/local/lib/python2.7/site-packages/pytest.pyc
setuptools registered plugins:
pytest-xdist-1.22.2 at /home/foo_cok_d/local/lib/python2.7/site-packages/xdist/looponfail.py
pytest-xdist-1.22.2 at /home/foo_cok_d/local/lib/python2.7/site-packages/xdist/plugin.py
pytest-forked-0.2 at /home/foo_cok_d/local/lib/python2.7/site-packages/pytest_forked/__init__.pyc
Run Code Online (Sandbox Code Playgroud)
在更简单(较小)的virtualenv中,它可以工作(相同的pytest版本,但没有插件)。
可能是什么原因?
如何调试呢?
我找到了解决方法。
如果我这两行,则该-s选项(--capture = no的快捷方式)py.test适用。
def test_when_the_moon_is_in_the_seventh_house(self):
+ import hunter
+ hunter.trace(module_startswith='modlink')
...
Run Code Online (Sandbox Code Playgroud)
我将看到比赛,我很高兴。
一个无需修改源代码的解决方案将是不错的选择。
| 归档时间: |
|
| 查看次数: |
234 次 |
| 最近记录: |