- 错误信息:
之前运行好好的脚本,突然报No tests were found,Empty test suite,详情错误信息如下所示:
Launching pytest with arguments loanlaterOfflineExtend.py::LoanlaterOfflineExtend::test_ConfirmLoanOffline3 in D:\script\py_jjd\TestCase
============================= test session starts =============================
platform win32 -- Python 3.6.1, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: D:\script\py_jjd\TestCase, inifile:
======================== no tests ran in 0.36 seconds =========================
ERROR: not found: D:\script\py_jjd\TestCase\loanlaterOfflineExtend.py::LoanlaterOfflineExtend::test_ConfirmLoanOffline3
(no name 'D:\\script\\py_jjd\\TestCase\\loanlaterOfflineExtend.py::LoanlaterOfflineExtend::test_ConfirmLoanOffline3' in any of [<UnitTestCase 'LoanlaterOfflineExtend'>])
- 解决方法:个人习惯,类似场景用例命名规则在后面用数字加以区别例如test_a1、test_a2、test_a3,python之前的版本是支持这样设计的,但现在认为这样的为重复用例名
将用例名从 test_a1、test_a2、test_a3 改test_aA、test_aB、test_aC 如下图所示就可以过了: