unittest "ResourceWarning: unclosed

将代码封装,并使用unittest调用时,返回如下警告:

C:\python3.6\lib\collections\__init__.py:431: ResourceWarning: unclosed

 

解决办法,可以通过warnings库来忽略掉相关告警。

import warnings
warnings.simplefilter("ignore", ResourceWarning)

转载于:https://www.cnblogs.com/peng-lan/p/9640320.html

你可能感兴趣的:(unittest "ResourceWarning: unclosed)