jianbing / utx

对Python unittest的功能进行了扩展(用例排序,分组,数据驱动,可视化报告等)
MIT License
145 stars 59 forks source link

控制台打印的测试用例数量和index不对 #8

Open chengguanghua opened 4 years ago

chengguanghua commented 4 years ago

2019-10-19 16:35:17,300 WARNING doctest.test_skip没有用例描述 2019-10-19 16:35:17,319 WARNING test_baidu.test_timedistance_v0没有用例描述 2019-10-19 16:35:17,319 INFO 开始测试,用例数量总共10个,跳过0个,实际运行10个 2019-10-19 16:35:17,420 INFO start to test test_baidu.test_timedistance_v0 (2/10) 2019-10-19 16:35:17,519 INFO start to test test_baidu.test_timedistance_v0 (3/10) 2019-10-19 16:35:17,619 INFO start to test test_tattle.test_get_battle_reward (9/10) 2019-10-19 16:35:17,720 INFO start to test test_tattle.test_get_battle_reward (10/10) 2019-10-19 16:35:17,819 INFO start to test test_tattle.test_bless (4/10) 2019-10-19 16:35:17,920 INFO start to test test_tattle.test_bless (5/10) 2019-10-19 16:35:18,019 INFO start to test test_tattle.test_receive_bless_box (6/10) 2019-10-19 16:35:18,119 INFO start to test test_tattle.test_receive_bless_box (7/10) 2019-10-19 16:35:18,220 INFO start to test test_tattle.test_receive_bless_box (8/10) 2019-10-19 16:35:18,220 INFO Time Elapsed: 0:00:00.900000

真实情况是用例只有9个,统计结果是10个,index也有点问题,不是从第1个开始计数

BirdLearn commented 4 years ago

根本原因没有找到,但是提供一个规避的方法,在core.py的Meta类的new方法 【# 注入测试数据】逻辑之前加入以下代码可以解决问题 if case_info == "doctest.test_skip": continue