测试对http/udp服务器的请求的一组fixture
pytest-mockservers的Python项目详细描述
pytest模拟服务器
pytest-mockservers
包提供了一组fixture,可以帮助您在需要检查发送到http/udp服务器的请求是否真的发送时测试代码。
可用夹具:
http_server
http_server_factory
unused_port
unused_port_factory
unused_udp_port
unused_udp_port_factory
udp_server_factory
安装
$ pip install pytest-mockservers
用法
查看tests/*
以找到pytest-mockserver
fixture用法的实际示例。
贡献
要使用pytest-mockservers
代码库,您需要在本地克隆项目并通过poetry:
$ git clone git@github.com:Gr1N/pytest-mockservers.git
$ poetry install
要运行测试和linter,请使用下面的命令:
$ poetry run tox
如果只想运行测试或linter,可以显式指定要运行的测试环境,例如:
$ poetry run tox -e py37-tests
许可证
pytest-mockservers
在mit许可下获得许可。有关详细信息,请参见许可文件。