【发布时间】:2012-05-18 05:28:09
【问题描述】:
使用以下代码:
import pytest
def test_a():
with pytest.raises(Exception):
1/0
如果我在上面运行 pylint,它会抱怨“raises”不是模块 pytest 的成员:
E: 3,9:test_a: Module 'pytest' has no 'raises' member
这显然不是真的。知道为什么 pylint 会犯这样的错误吗?这是一个已知的错误吗?
py.test 版本:
> py.test --version
This is py.test version 2.2.3, imported from C:\Python27\lib\site-packages\pytest.pyc
PyLint 版本:
> pylint --version
No config file found, using default configuration
pylint 0.25.1,
astng 0.23.1, common 0.57.1
Python 2.7.2 (default, Jun 24 2011, 12:22:14) [MSC v.1500 64 bit (AMD64)]
【问题讨论】:
-
如果您能提供您正在使用的 pylint 版本(pylint --version 的输出)以及 py.test 的版本,那将会很有用。
-
@gurneyalex 嗨 Gurney,我已将原始问题更新为包含版本信息。谢谢。