unittest __import__加载名为‘1’的model无法找到

python版本

img


unittest版本

img


项目文件代以及报错

img


如何处理?

导入import unittest 包 ,创建的文件名字得是 Test 开头的
将文件名改为testcase.py试试,开头不要用那个1。
有帮助的话采纳一下哦!

img

ImportError:Failed to import test module:1
ImportError:未能导入测试模块:1
这里有2处地方需要注意:
1、class my_test, 根据命名规则中首字母需要大写,需要改写为:class Test
【导入import unittest 包 ,创建的文件名字得是 Test 开头的】
2、将文件夹改为testproject,文件改为了first_test就可以了

img