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()
评论列表
文章目录