Exemplo n.º 1
0
def test_link_created_on_non_nested_path(base_info, tmp_dir, dvc, scm):
    tree = S3RemoteTree(dvc, {"url": str(base_info.parent)})
    cache = CloudCache(tree)
    s3 = cache.tree.s3
    s3.create_bucket(Bucket=base_info.bucket)
    s3.put_object(Bucket=base_info.bucket,
                  Key=(base_info / "from").path,
                  Body="data")
    cache.link(base_info / "from", base_info / "to")

    assert cache.tree.exists(base_info / "from")
    assert cache.tree.exists(base_info / "to")
Exemplo n.º 2
0
    def getter(self):
        from dvc.remote import get_cloud_tree
        from dvc.remote.base import CloudCache

        remote = self.config.get(name)
        if not remote:
            return None

        tree = get_cloud_tree(self.repo, name=remote)
        return CloudCache(tree)
Exemplo n.º 3
0
def test_checkout_for_external_outputs(tmp_dir, dvc):
    dvc.cache.s3 = CloudCache(S3RemoteTree(dvc, {"url": S3.get_url()}))

    remote = Remote(S3RemoteTree(dvc, {"url": S3.get_url()}))
    file_path = remote.path_info / "foo"
    remote.tree.s3.put_object(
        Bucket=remote.path_info.bucket, Key=file_path.path, Body="foo"
    )

    dvc.add(str(remote.path_info / "foo"), external=True)

    remote.tree.remove(file_path)
    stats = dvc.checkout(force=True)
    assert stats == {**empty_checkout, "added": [str(file_path)]}
    assert remote.tree.exists(file_path)

    remote.tree.s3.put_object(
        Bucket=remote.path_info.bucket, Key=file_path.path, Body="foo\nfoo"
    )
    stats = dvc.checkout(force=True)
    assert stats == {**empty_checkout, "modified": [str(file_path)]}