1.在进行unittest测试时,运行报错如下 

导入import unittest 包 ,创建的文件名字得是 Test 开头的,不然报如下的错误

我的文件名字是 2.unittest简单实用-first_test会出现报错ImportError: Failed to import test module: 2这里面的2就是我命名里面的 

解决办法:将文件夹改为testproject,文件改为了first_test就可以了

ImportError: Failed to import test module: 2

ImportError: Failed to import test module: 2

 改为以下

ImportError: Failed to import test module: 2

运行

 ImportError: Failed to import test module: 2

2.当运行出现ModuleNotFoundError: No module named 'selenium'这样的报错的时候,需要设置以下python路径,查看以下是否存在selenium

ImportError: Failed to import test module: 2 如下步骤操作就可以解决

ImportError: Failed to import test module: 2ImportError: Failed to import test module: 2

ImportError: Failed to import test module: 2 ImportError: Failed to import test module: 2

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2021-11-08
  • 2021-12-24
  • 2021-05-20
猜你喜欢
  • 2021-11-16
  • 2022-12-23
  • 2021-06-17
  • 2021-08-09
  • 2022-12-23
相关资源
相似解决方案