test_utils.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:daisy 作者: opnfv 项目源码 文件源码
def test_check_file_exists(mock_err_exit, tmpdir, test_file_name, include_dirname):
    if include_dirname:
        file_path = os.path.join(tmpdir.dirname, tmpdir.basename, test_file_name)
        if test_file_name == 'exist_file':
            os.mknod(file_path)
    else:
        file_path = test_file_name
    check_file_exists(file_path)
    if include_dirname is True:
        if test_file_name == 'exist_file':
            mock_err_exit.assert_not_called()
        else:
            mock_err_exit.assert_called_once()
    if include_dirname is False:
        mock_err_exit.assert_called_once()
    tmpdir.remove()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号