简单的网络监听器
项目描述
使用TCP的简单JSON监听器,监听数据并将其存储在队列中以供稍后检索。
安装
使用您喜欢的包管理器进行安装
pip install pytest-listener
# or..
easy_install pytest-listener
在测试或conftest.py中显式启用固定装置(当使用setuptools入口点时不需要)
pytest_plugins = ['pytest_listener']
基本测试用法
以下是一个展示基本功能的测试示例
def test_listener(listener):
data1 = {'foo': 1}
listener.send(some_data)
data2 = {'bar': 2}
listener.send(some_data)
assert listener.receive() == data1
assert listener.receive() == data2
data3 = {'baz': 3}
listener.send(some_data)
# Clear the listening queue - this deletes data3
listener.clear_queue()
data2 = {'qux': 4}
listener.send(some_data)
assert listener.recieve() == data3
变更日志
1.7.0
所有:支持pytest >= 4.0.0
所有:支持Python 3.7
pytest-server-fixtures:如果您的机器上未定义主机,则默认为主机名
pytest-server-fixture:由于上游API更改,将rethinkdb固定到< 2.4.0
pytest-verbose-parametrize: 添加对改进的标记基础设施的支持
pytest-verbose-parametrize: 修复集成测试以支持 pytest >= 4.1.0
pytest-virtualenv: 添加 virtualenv 作为安装需求。修复 #122
pytest-webdriver: 使用 getfixturevalue 修复 RemovedInPytest4Warning
circleci: 通过跳过没有推送访问权限的开发者的 coverall 提交来修复检查
wheels: 生成既适用于 python 2.x 也适用于 3.x 的通用 wheels
dist: 移除对构建和分发 *.egg 文件的支持
VagrantFile: 安装 python 3.7 并默认初始化 python 3.7
使用“logger.warning()”函数修复 DeprecationWarning 警告
1.6.2 (2019-02-21)
pytest-server-fixtures: 如果调用 kill(),则抑制堆栈跟踪
pytest-server-fixtures: 修复 TestServerV2 中的随机端口逻辑
1.6.1 (2019-02-12)
pytest-server-fixtures: 修复尝试访问主机名而服务器未启动时的异常
1.6.0 (2019-02-12)
pytest-server-fixtures: 添加之前已删除的 TestServerV2.kill() 函数
pytest-profiling: 在集成测试中固定 more-itertools==5.0.0,因为这是一个仅适用于 PY3 的发布
1.5.1 (2019-01-24)
pytest-verbose-parametrize: 修复使用 @pytest.mark.parametrize 时的 Unicode 参数
1.5.0 (2019-01-23)
pytest-server-fixtures: 使 postgres fixture 及其测试可选,就像所有其他 fixture 一样
pytest-server-fixtures: 撤销对 pymongo 降级警告的修复,因为这会破坏与 pymongo 3.6.0 的兼容性
pytest-server-fixtures: 在 httpd 中弃用 RHEL5 支持
1.4.1 (2019-01-18)
pytest-server-fixtures: 现在仅在服务器类 'thread' 中影响由 ENV 指定的服务器 fixture 二进制路径
1.4.0 (2019-01-15)
在 Simple HTTP Server fixture 中修复 python 3 兼容性
修复 pytest-profiling 中的损坏测试
固定 pytest <4.0.0,直到所有弃用警告都修复。
pytest-webdriver: 用无头 Google Chrome 替换已弃用的 phantomjs
将 Vagrantfile 添加到项目中,以便使测试环境可移植。
将 .editorconfig 文件添加到项目中。
pytest-server-fixtures: 添加具有 Docker 和 Kubernetes 支持的 TestServerV2。
pytest-server-fixtures: 修复 MinioServer 使用后未清理的问题。
pytest-server-fixtures: 修复调用 pymongo 时的弃用警告。
pytest-server-fixtures: 在 MongoTestServer 销毁时关闭 pymongo 客户端。
pytest-server-fixtures: 将 Mongo、Redis 和 RethinkDB 升级到 TestServerV2。
coveralls: 修复损坏的 coveralls
1.3.1 (2018-06-28)
使用 pymongo list_database_names() 替代已弃用的 database_names(),并添加 pymongo>=3.6.0 依赖项
1.3.0 (2017-11-17)
修复 teardown 为 None 时的工作区删除问题
修复 pytest-listener 中根记录器的压缩问题
添加 S3 Minio fixture(感谢 Gavin Bisesi)
添加 Postgres fixture(感谢 Gavin Bisesi)
使用 requests 对服务器 fixture 的 http get 进行处理,因为它正确处理重定向和代理
1.2.12 (2017-8-1)
修复对缓存临时主机名的回归,一些客户端依赖于此。现在这是可选的。
1.2.11 (2017-7-21)
修复 OSX 绑定到非法本地 IP 范围的问题(感谢 Gavin Bisesi)
为 pytest-profiling 设置和 Py3k 修复(感谢 xoviat)
不再尝试在保留本地 IP 主机时绑定端口 5000,因为有人可能将其绑定到 0.0.0.0
修复在本地 venv 未激活时调用 gprof2dot 的问题
1.2.10 (2017-2-23)
在 pytest-webdriver 中处理自定义 Pytest 测试项
1.2.9 (2017-2-23)
将用户名添加到 mongo 服务器 fixture 的 tempdir 路径中,以防止在共享多用户文件系统上发生冲突
1.2.8 (2017-2-21)
在 shutil.run.run_as_main 中返回函数结果
1.2.7 (2017-2-20)
对 path.py 的较旧版本进行更多处理
允许在 pytest-virtualenv 中传递 virtualenv 参数
1.2.6 (2017-2-16 )
更新 devpi 服务器设置以支持 devpi-server >= 2.0
对随机端口选择进行改进
HTTPD 服务器现在默认绑定到 0.0.0.0 以辅助 Selenium 风格的测试
更新 mongodb 服务器参数以支持 mongodb >= 3.2
对 mongodb fixture 配置进行更正并改进启动逻辑
添加模块范围 mongodb fixture
对 path.py 的较旧版本进行处理
修复了#40问题,其中chdir测试会导致pytest-profiling崩溃
1.2.5 (2016-12-09)
服务器运行程序主机和端口生成的改进,现在支持随机本地IP
修复了RethinkDB fixture配置的bug
1.2.4 (2016-11-14)
修复了pymongo额外依赖的bug
针对pytest-virtualenv的Windows兼容性修复(感谢Jean-Christophe Fillion-Robin提供的PR)
修复pytest-shutil.cmdline.get_real_python_executable中的符号链接处理
1.2.3 (2016-11-7)
提高Mongo fixture启动检查的鲁棒性
1.2.2 (2016-10-27)
大部分模块支持Python 3兼容性
修复了过时的Path.py导入(感谢Bryan Moscon)
修复了pytest-profiling中过时的multicall(感谢Paul van der Linden提供的PR)
添加了devpi-server fixture以为每个测试函数创建一个索引
添加了缺失的许可文件
将httpd服务器fixture配置拆分,以便子类更容易覆盖加载的模块
向TestServer基类添加了“preserve_sys_path”参数,该参数将当前python sys.path导出到子进程中。
更新了httpd、redis和jenkins的运行时参数和路径,以符合当前的Ubuntu规范
在拆卸工作区时忽略错误,以避免shutil.rmtree实现中的竞争条件
1.2.1 (2016-3-1)
修复了pytest-verbose-parametrize以适应最新版本的py.test
1.2.0 (2016-2-19)
新插件:git仓库fixture
1.1.1 (2016-2-16)
pytest-profiling改进:在.prof文件中转义非法字符(感谢Aarni Koskela提供的PR)
1.1.0 (2016-2-15)
新插件:devpi服务器fixture
pytest-profiling改进:过长的.prof文件以测试名称的短哈希保存(感谢Vladimir Lagunov提供的PR)
出于安全原因,将workspace.run()的默认行为改为不使用子shell
修正了virtualenv.run()方法,使其与父方法workspace.run()处理相同的参数
从virtualenv参数中移除了过时的“–distribute”
1.0.1 (2015-12-23)
修复了打包bug
1.0.0 (2015-12-21)
首次公开发布
项目详情
下载文件
下载适用于您平台文件的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
构建的发行版
pytest-listener-1.7.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | e5582c34bcbd19143a2df75a9dda5da44a08c48c528276c0a8049a33afbc3baa |
|
MD5 | d7ce2b98e36edc47bb0bae2d6d3f9d63 |
|
BLAKE2b-256 | e7e43da618f70d98c12ae7d92b4ec32134916392711ae8b5df4deeda464464b0 |