【发布时间】:2016-06-11 17:13:05
【问题描述】:
我开始阅读 python requests 库。
我做的第一件事是在本地运行 pytest。
然后我收到此错误消息:
@pytest.fixture
def httpbin(httpbin):
fixture 'httpbin' not found
available fixtures: tmpdir_factory, httpbin_secure, pytestconfig, httpbin, cov, cache, recwarn, monkeypatch, record_xml_property, capfd, capsys, tmpdir
use 'py.test --fixtures [testpath]' for help on them.
在测试模块的conftest.py文件中,它尝试创建一个fixture:
@pytest.fixture
def httpbin(httpbin):
return prepare_url(httpbin)
如何使用 httpbin 固定装置创建 httpbin 固定装置? 我错过了什么?
【问题讨论】:
-
你为什么把这两个方法都称为参数
httpbin? -
@LutzHorn:代码来自请求 conftest.py。它试图通过使用夹具
httpbin创建一个名为httpbin的夹具。这是我困惑的根源。
标签: python python-requests pytest