Python3 使用unittest时,没有报错,但提示:ResourceWarning

解决方法:

  在报警告的文件头里导入warnings模块,然后调用忽略warnings函数
import warnings

def XXX(self):
     warnings.simplefilter('ignore', ResourceWarning)

你可能感兴趣的:(Python3 使用unittest时,没有报错,但提示:ResourceWarning)