test_aws_encryption_sdk_cli.py 文件源码

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

项目:aws-encryption-sdk-cli 作者: awslabs 项目源码 文件源码
def build_same_files_and_dirs(tmpdir, source_is_symlink, dest_is_symlink, use_files):
    """Build temporary files or directories to test indication of same source and destination.

    :param bool source_is_symlink: Should the source be a symlink to the destination (both cannot be True)
    :param bool dest is symlink: Should the destination be a symlink to the source (both cannot be True)
    :param bool use_files: Should files be created (if False, directories are used instead)
    """
    if use_files:
        real = tmpdir.join('real')
        real.write('some data')
    else:
        real = tmpdir.mkdir('real')
    link = tmpdir.join('link')

    if source_is_symlink or dest_is_symlink:
        os.symlink(str(real), str(link))

        if source_is_symlink:
            return str(link), str(real)
        elif dest_is_symlink:
            return str(real), str(link)

    return str(real), str(real)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号