我安装了一个pytest插件,从这里下载:http://pypi.python.org/pypi/pytest-cov。然后我有一个简单的测试代码:
pytest.py:
class TestNumbers:
def test_int_float(self):
assert 1 == 1.0
def test_int_str(self):
assert 1 == 1
我尝试使用命令 py.test --cov-report term --cov pytest.py
进行测试,但无效。即使我提供了pytest.py的完整绝对路径,仍然没有数据进行收集。然而,如果我使用py.test pytest.py
,它肯定可以正常测试。
我对这个问题感到非常困惑,感谢您的帮助。