前言
使用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) 
python自动化交流 QQ群:779429633 |