模拟打开python中的单元测试 2019年8月3日 python-mock 0条评论 33次阅读 0人点赞 我想使用unittest测试一个使用上下文管理器从文件读取的方法: with open(k_file, 'r') as content_file: content = content_file.read() 我不想在我的…