Example #1
0
def _get_src_dst():
    base_info = S3Remote.path_cls(S3.get_url())
    return base_info / "from", base_info / "to"
Example #2
0
def test_makedirs_doesnot_try_on_top_level_paths(tmp_dir, dvc, scm):
    base_info = S3Remote.path_cls("s3://bucket/")
    remote = S3Remote(dvc, {"url": str(base_info)})
    remote.makedirs(base_info)
Example #3
0
@mock_s3
def test_copy_singlepart_preserve_etag():
    from_info, to_info = _get_src_dst()

    s3 = boto3.client("s3")
    s3.create_bucket(Bucket=from_info.bucket)
    s3.put_object(Bucket=from_info.bucket, Key=from_info.path, Body="data")

    S3Remote._copy(s3, from_info, to_info, {})


@mock_s3
@pytest.mark.parametrize(
    "base_info",
    [S3Remote.path_cls("s3://bucket/"), S3Remote.path_cls("s3://bucket/ns/")],
)
def test_link_created_on_non_nested_path(base_info, tmp_dir, dvc, scm):
    remote = S3Remote(dvc, {"url": str(base_info.parent)})
    remote.s3.create_bucket(Bucket=base_info.bucket)
    remote.s3.put_object(
        Bucket=base_info.bucket, Key=(base_info / "from").path, Body="data"
    )
    remote.link(base_info / "from", base_info / "to")

    assert remote.exists(base_info / "from")
    assert remote.exists(base_info / "to")


@mock_s3
def test_makedirs_doesnot_try_on_top_level_paths(tmp_dir, dvc, scm):