python 使用unittest时,提示:ResourceWarning
一、python 使用unittest时,提示:ResourceWarning,怎么解决?
①、具体提示信息,详情如下:
D:\Program Files\Python\Python36\lib\socket.py:657: ResourceWarning: unclosed <ssl.SSLSocket fd=1380, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=(‘x.x.x.x’, x), raddr=(‘x.x.x.x’, 465)>
self._sock = None
②、解决方案:
import warnings
def setUp(self):
warnings.simplefilter('ignore', ResourceWarning)