您的位置:首页 > 编程语言 > Python开发

python笔记31-使用ddt报告出现dict() -> new empty dictionary dict(mapping) 问题解决

2018-09-28 16:42 751 查看

前言

使用ddt框架生成html报告的时候出现dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) ->

遇到问题

使用ddt框架生成html报告的时候,出现:dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) ->

出现这个问题主要是新版本的ddt框架的一个BUG

解决办法

先查看ddt版本号Version: 1.2.0

pip show ddt

Name: ddt
Version: 1.2.0
Summary: Data-Driven/Decorated Tests
Home-page: https://github.com/txels/ddt
Author: Carles Barrobés
Author-email: carles@barrobes.com
License: UNKNOWN
Location: d:\soft\python3.6\lib\site-packages
Requires:
Required-by:

先卸载了,再安装一个低一点的ddt版本就好了

pip uninstall ddt
pip install ddt==1.1.2

接下来重新运行代码,生成的报告就不会出现这种问题了

对比源码

Version: 1.1.2源码

Version: 1.2.0源码里面少一行:test_docstring = getattr(v, "doc", None)

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐