【发布时间】:2017-05-25 12:07:24
【问题描述】:
我已将 conftest.py 添加到与我的测试文件相同的目录级别。我的 conftest.py 的内容:
import pytest
def pytest_addoption(parser):
parser.addoption("--l", action="store", help="Get license value")
@pytest.fixture
def lic(request):
return request.config.getoption("--l")
以下是我的测试文件定义
def test(lic):
print "testing license : %s"%lic
assert 0
但我仍然收到以下错误:
pytest .\source\test_latestLinuxAgent.py --l=test
pytest : usage: pytest [options] [file_or_dir] [file_or_dir] [...]
At line:1 char:1
+ pytest .\source\test_latestLinuxAgent.py --l=test
pytest: error: ambiguous option: --l=test could match --lf, --last-failed
【问题讨论】:
标签: python command-line-arguments pytest