使用命令行运行用例时提示python.exe: Error while finding module specification for 'testcase_1.Test'.....

文件路径

输入命令 D:\demo>python -m unittest unittest_1/testcase_1.Test结果提示 ModuleNotFoundError: No module named 'unittest_1/testcase_1',详情如图

 解决方法:进入到unittest_1路径下再输入命令 python -m unittest testcase_1.Test

 输入命令 python -m testcase_1.Test结果提示Error while finding module specification for 'testcase_1.Test' (ModuleNotFoundError: __path__ attribute not found on 'testcase_1' while trying to find 'testcase_1.Test')

 解决方法:命令语句有误,执行命令为 python -m unittest 模块名.类名

 

posted @ 2021-10-12 18:16  **绵绵羊**  阅读(1077)  评论(0)    收藏  举报