程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python runs unittest as a package import error, attributeerror: module unittest has no attribute main‘

編輯:Python

It didn't work for a long time python 了 , Use today python I made a very low-level mistake when writing test code , I'd better post it , Warn yourself not to make mistakes next time !

Source code :

Error report after operation module ‘unittest’ has no attribute ‘main’

The reason for the error :
unittest Can't find mian attribute , I've been looking for mistakes for a long time , I found that my package name was written as unittest, This leads to import This package is imported , Instead of testing the framework

modify :
Change the package name to something else , The code doesn't need to be modified


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved