py.test集成响应
项目描述
自动激活py.test测试套件中的响应(从而防止HTTP请求)。
$ pip install pytest-responses
如果特定测试需要访问外部域名,您可以使用withoutresponses标记
@pytest.mark.withoutresponses
def test_disabled():
with pytest.raises(ConnectionError):
requests.get('http://responses.invalid')
assert len(responses.calls) == 0
此外,您还可以使用responses测试夹具
def test_enabled(responses):
with pytest.raises(ConnectionError):
requests.get('http://responses.invalid')
assert len(responses.calls) == 1
项目详情
关闭
pytest_responses-0.5.1-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 4172e565b94ac1ea3b10aba6e40855ad60cd7f141476b2d8a47e4b5f250be734 |
|
MD5 | ab189988bba0ed270930b95330a49d3d |
|
BLAKE2b-256 | c40a81b8cc3cf4b6605d97ed37217af9e2f82c97ebe130f60cf85fe82edfe0e1 |