unittest 警告ResourceWarning
id = yaml.safe_load(open('./docs/test.yml', 'r'))
警告ResourceWarning一般是因为文件没有被正确关闭,上述代码可修改为
file = open('./docs/test.yml', 'r')
id = yaml.safe_load(file)
file.close()
或使用with open
with open ('./docs/test.yml', 'r')
id = yaml.safe_load(file)