pytest异步网络模拟器:pytest的插件,用于模拟器测试中的网络
pytest-asyncio-network-simulator的Python项目详细描述
一个用于pytest的插件,它模拟各种网络 asyncioapi,而不是通过 套接字,通信直接发生在内存中。
阅读documentation on ReadTheDocs中的更多内容。 View the change log。
快速启动
pip install pytest-asyncio-network-simulator
开发人员设置
如果你想破解pytest-asyncio-network-simulator, 请查看Ethereum Development Tactical Manual 有关我们如何做的信息:
- 测试
- 拉取请求
- 代码样式
- 文档
开发环境设置
您可以使用以下命令设置开发环境:
git clone git@github.com:ethereum/pytest-asyncio-network-simulator.git cd pytest-asyncio-network-simulator virtualenv -p python3 venv . venv/bin/activate pip install -e .[dev]
测试设置
在开发过程中,您可能希望在每次保存文件时都运行测试。
更改文件时显示flake8错误:
# Test flake8 when-changed -v -s -r -1 asyncio_network_simulator/ tests/ -c "clear; flake8 asyncio_network_simulator tests && echo 'flake8 success' || echo 'error'"
在一个命令中运行多进程测试,但不使用颜色:
# in the project root: pytest --numprocesses=4 --looponfail --maxfail=1# the same thing, succinctly: pytest -n 4 -f --maxfail=1
在一个线程中运行,带有颜色和桌面通知:
cd venv ptw --onfail "notify-send -t 5000 'Test failure ⚠⚠⚠⚠⚠' 'python 3 test on pytest-asyncio-network-simulator failed'" ../tests ../asyncio_network_simulator
释放设置
对于类似Debian的系统:
apt install pandoc
发布新版本:
make release bump=$$VERSION_PART_TO_BUMP$$
如何颠簸
此repo的版本格式为 稳定,{major}.{minor}.{patch}-{stage}.{devnum}表示不稳定 (stage可以是alpha或beta)。
若要在行中发布下一个版本,请指定要凹凸的部分,如 make release bump=minor或make release bump=devnum。
如果您是beta版本,make release bump=stage将切换到 马厩。
若要在当前版本稳定时发布不稳定版本,请指定 新版本显式地 make release bump="--new-version4.0.0-alpha.1 devnum"