- 錯誤信息:
之前運行好好的腳本,突然報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 如下圖所示就可以過了: