未提供项目描述
项目描述
安装
来自 PyPi
pip install pytest-ngrok
或来自 git
pip install -e git+https://githib.com/Apkawa/pytest-ngrok.git#egg=pytest-ngrok
用法
import pytest
from urllib.error import HTTPError
from urllib.request import urlopen
def test_ngrok(ngrok, httpserver):
httpserver.expect_request("/foobar").respond_with_data("ok")
remote_url = ngrok(httpserver.port)
assert urlopen(remote_url + "/foobar").read() == b'ok'
def test_ngrok_context_manager(ngrok, httpserver):
# example local server
httpserver.expect_request("/foobar").respond_with_data("ok")
with ngrok(httpserver.port) as remote_url:
_test_url = str(remote_url) + '/foobar'
assert urlopen(_test_url).read() == b'ok'
# Connection closes
pytest.raises(HTTPError, urlopen, _test_url)
带pytest-django可使用夹具live_server_ngrok
def test_server(live_server_ngrok):
assert live_server_ngrok.url.endswith('ngrok.io')
贡献
初始化
python -m venv /tmp/.venv/pytest-ngrok
source /tmp/.venv/pytest-ngrok/activate
pip install -r requirements-dev.txt
运行测试
pytest
tox
更新版本
python setup.py bumpversion
发布 pypi
python setup.py publish
项目详情
关
pytest_ngrok -0.0.4-py2.py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 63f20da1448c4271fe41671a164d7266928d6be6a2b4360383d8d102c368bbe0 |
|
| MD5 | 3d82bdb90e9bdd59c552c8abd83bd4c4 |
|
| 布莱克2-256 | 56470d16d3ad10a22c08259ec79f8ce8f83d4139ed69d34b86503ceea6dd94cc |