跳转到主要内容

为参数化的pytest测试提供更详细的结果输出

项目描述

pytest参数化钩子用于生成比默认(仅输出id号)更详细的参数化测试id。

安装

使用您喜欢的包管理器进行安装,此插件将自动启用

pip install pytest-verbose-parametrize
# or ..
easy_install pytest-verbose-parametrize

用法

import pytest

@pytest.mark.parametrize(('f', 't'), [(sum, list), (len, int)])
def test_foo(f, t):
    assert isinstance(f([[1], [2]]), t)

在此示例中,测试id将生成为test_foo[sum-list]test_foo[len-int]而不是默认的test_foo[1-2]test_foo[3-4]

$ py.test -v
============================= test session starts ======================================
platform linux2 -- Python 2.7.3 -- py-1.4.25 -- pytest-2.6.4
plugins: verbose-parametrize
collected 2 items

unit/test_example.py::test_foo[sum-list] FAILED
unit/test_example.py::test_foo[len-int] PASSED

变更日志

1.7.0

  • 所有: 支持 pytest >= 4.0.0

  • 所有:支持Python 3.7

  • pytest-server-fixtures:如果您的机器上未定义主机,则默认为localhost

  • 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 fixtures及其测试成为可选的,就像所有其他fixtures一样

  • pytest-server-fixtures:撤销对pymongo弃用警告的修复,因为这将破坏与pymongo 3.6.0的兼容性

  • pytest-server-fixtures:在httpd中删除对RHEL5的支持

1.4.1 (2019-01-18)

  • pytest-server-fixtures:在ENV中指定的服务器二进制路径现在仅影响服务器类'thread'

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进行服务器固定http获取,因为它正确处理重定向和代理

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

  • 修复#46在本地venv未激活时源gprof2dot的问题

1.2.10 (2017-2-23)

  • 在pytest-webdriver中处理自定义Pytest测试项

1.2.9 (2017-2-23)

  • 将用户名添加到mongo服务器固定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固定配置,并改进启动逻辑

  • 添加模块作用域的mongodb固定

  • 对path.py较旧版本进行处理

  • 修复#40中的问题,即chdir会破坏pytest-profiling

1.2.5 (2016-12-09)

  • 对服务器运行器主机和端口生成进行了改进,现在支持随机本地IP

  • 修复了RethinkDB配置问题

1.2.4 (2016-11-14)

  • 修复了pymongo额外依赖问题

  • 修复了pytest-virtualenv在Windows上的兼容性问题(感谢Jean-Christophe Fillion-Robin提供的PR)

  • 修复了pytest-shutil.cmdline.get_real_python_executable的符号链接处理问题

1.2.3 (2016-11-7)

  • 提高了Mongo配置启动检查的容错性

1.2.2 (2016-10-27)

  • 大多数模块支持Python 3兼容性

  • 修复了Path.py的过时导入(感谢Bryan Moscon)

  • 修复了pytest-profiling中的过时multicall(感谢Paul van der Linden提供的PR)

  • 添加了devpi-server配置,为每个测试函数创建一个索引

  • 添加了缺失的许可文件

  • 将httpd服务器配置拆分,以便子类更容易覆盖已加载的模块

  • 为TestServer基类添加了'preserve_sys_path'参数,将当前的python sys.path导出到子进程中。

  • 更新了httpd、redis和jenkins运行时参数和路径,以符合当前Ubuntu规范

  • 在拆除工作空间时忽略错误,以避免在'shutil.rmtree'实现中的竞态条件

1.2.1 (2016-3-1)

  • 修复了pytest-verbose-parametrize的最新版本

1.2.0 (2016-2-19)

  • 新插件:git仓库配置

1.1.1 (2016-2-16)

  • pytest-profiling改进:在.prof文件中转义非法字符(感谢Aarni Koskela提供的PR)

1.1.0 (2016-2-15)

  • 新插件:devpi服务器配置

  • pytest-profiling改进:过长的.prof文件以测试名的短哈希值保存(感谢Vladimir Lagunov提供的PR)

  • 出于安全原因,将workspace.run()的默认行为更改为不使用子shell

  • 修正了virtualenv.run()方法,使其与父方法workspace.run()处理相同的参数

  • 从virtualenv参数中移除了过时的‘–distribute’

1.0.1 (2015-12-23)

  • 打包错误修复

1.0.0 (2015-12-21)

  • 首次公开发布

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

pytest-verbose-parametrize-1.7.0.tar.gz (12.3 kB 查看散列值)

上传时间 源代码

已构建的分发

pytest_verbose_parametrize-1.7.0-py3.6.egg (5.7 kB 查看散列值)

上传时间 源代码

pytest_verbose_parametrize-1.7.0-py2.py3-none-any.whl (6.7 kB 查看散列值)

上传时间 Python 2 Python 3

pytest_verbose_parametrize-1.7.0-py2.7.egg (5.7 kB 查看散列值)

上传时间 源代码

由以下支持