mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-12-02 15:28:29 +01:00
revert changes
This commit is contained in:
@@ -2,7 +2,6 @@ from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import filecmp
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
from mock import patch
|
||||
@@ -68,23 +67,6 @@ def test_pull_imported_stage(dvc_repo, erepo):
|
||||
assert os.path.isfile(dst_cache)
|
||||
|
||||
|
||||
def test_pull_imported_directory_stage(dvc_repo, erepo):
|
||||
src = erepo.DATA_DIR
|
||||
dst = erepo.DATA_DIR + "_imported"
|
||||
stage_file = dst + ".dvc"
|
||||
|
||||
dvc_repo.imp(erepo.root_dir, src, dst)
|
||||
|
||||
shutil.rmtree(dst)
|
||||
shutil.rmtree(dvc_repo.cache.local.cache_dir)
|
||||
|
||||
dvc_repo.pull([stage_file])
|
||||
|
||||
assert os.path.exists(dst)
|
||||
assert os.path.isdir(dst)
|
||||
trees_equal(src, dst)
|
||||
|
||||
|
||||
def test_download_error_pulling_imported_stage(dvc_repo, erepo):
|
||||
src = erepo.FOO
|
||||
dst = erepo.FOO + "_imported"
|
||||
|
||||
@@ -245,5 +245,5 @@ def test_partial_push_n_pull(dvc_repo, repo_dir, caplog):
|
||||
|
||||
|
||||
def get_last_exc(caplog):
|
||||
_, exc, _ = caplog.records[-2].exc_info
|
||||
_, exc, _ = caplog.records[-1].exc_info
|
||||
return exc
|
||||
|
||||
@@ -964,8 +964,8 @@ class TestReproExternalS3(TestReproExternalBase):
|
||||
return "aws s3 cp {} {}".format(i, o)
|
||||
|
||||
def write(self, bucket, key, body):
|
||||
s3 = boto3.client("s3")
|
||||
s3.put_object(Bucket=bucket, Key=key, Body=body)
|
||||
s3 = boto3.resource("s3")
|
||||
s3.Bucket(bucket).put_object(Key=key, Body=body)
|
||||
|
||||
|
||||
class TestReproExternalGS(TestReproExternalBase):
|
||||
|
||||
@@ -29,7 +29,7 @@ def test_failed_import_url(mocker, caplog, dvc_repo):
|
||||
assert cmd.run() == 1
|
||||
expected_error = (
|
||||
"failed to import http://somesite.com/file_name. "
|
||||
"You could also try downloading it manually, and "
|
||||
"adding it with `dvc add`."
|
||||
"You could also try downloading it manually and "
|
||||
"adding it with `dvc add` command."
|
||||
)
|
||||
assert expected_error in caplog.text
|
||||
|
||||
@@ -111,9 +111,3 @@ def test_hardlink(repo_dir, ssh):
|
||||
def test_copy(repo_dir, ssh):
|
||||
ssh.copy("foo", "link")
|
||||
assert filecmp.cmp("foo", "link")
|
||||
|
||||
|
||||
def test_move(repo_dir, ssh):
|
||||
ssh.move("foo", "copy")
|
||||
assert os.path.exists("copy")
|
||||
assert not os.path.exists("foo")
|
||||
|
||||
@@ -5,7 +5,7 @@ from dvc.remote.local import RemoteLOCAL
|
||||
def test_status_download_optimization(mocker):
|
||||
"""When comparing the status to pull a remote cache,
|
||||
And the desired files to fetch are already on the local cache,
|
||||
Don't check the existence of the desired files on the remote cache
|
||||
Don't check the existance of the desired files on the remote cache
|
||||
"""
|
||||
remote = RemoteLOCAL(None, {})
|
||||
|
||||
|
||||
@@ -83,20 +83,3 @@ def test_walk_files(remote):
|
||||
]
|
||||
|
||||
assert list(remote.walk_files(remote.path_info / "data")) == files
|
||||
|
||||
|
||||
def test_copy_preserve_etag_across_buckets(remote):
|
||||
s3 = remote.s3
|
||||
s3.create_bucket(Bucket="another")
|
||||
|
||||
another = RemoteS3(None, {"url": "s3://another", "region": "us-east-1"})
|
||||
|
||||
from_info = remote.path_info / "foo"
|
||||
to_info = another.path_info / "foo"
|
||||
|
||||
remote.copy(from_info, to_info)
|
||||
|
||||
from_etag = RemoteS3.get_etag(s3, "bucket", "foo")
|
||||
to_etag = RemoteS3.get_etag(s3, "another", "foo")
|
||||
|
||||
assert from_etag == to_etag
|
||||
|
||||
@@ -45,7 +45,11 @@ class TestColorFormatter:
|
||||
with caplog.at_level(logging.INFO, logger="dvc"):
|
||||
logger.error("message")
|
||||
|
||||
expected = "{red}ERROR{nc}: message\n".format(**colors)
|
||||
expected = (
|
||||
"{red}ERROR{nc}: message\n"
|
||||
"\n"
|
||||
"{footer}".format(footer=formatter.footer, **colors)
|
||||
)
|
||||
|
||||
assert expected == formatter.format(caplog.records[0])
|
||||
|
||||
@@ -56,7 +60,11 @@ class TestColorFormatter:
|
||||
except Exception:
|
||||
logger.exception("message")
|
||||
|
||||
expected = "{red}ERROR{nc}: message\n".format(**colors)
|
||||
expected = (
|
||||
"{red}ERROR{nc}: message\n"
|
||||
"\n"
|
||||
"{footer}".format(footer=formatter.footer, **colors)
|
||||
)
|
||||
|
||||
assert expected == formatter.format(caplog.records[0])
|
||||
|
||||
@@ -67,7 +75,11 @@ class TestColorFormatter:
|
||||
except Exception:
|
||||
logger.exception("")
|
||||
|
||||
expected = "{red}ERROR{nc}: description\n".format(**colors)
|
||||
expected = (
|
||||
"{red}ERROR{nc}: description\n"
|
||||
"\n"
|
||||
"{footer}".format(footer=formatter.footer, **colors)
|
||||
)
|
||||
|
||||
assert expected == formatter.format(caplog.records[0])
|
||||
|
||||
@@ -78,8 +90,10 @@ class TestColorFormatter:
|
||||
except Exception:
|
||||
logger.exception("message")
|
||||
|
||||
expected = "{red}ERROR{nc}: message - description\n".format(
|
||||
**colors
|
||||
expected = (
|
||||
"{red}ERROR{nc}: message - description\n"
|
||||
"\n"
|
||||
"{footer}".format(footer=formatter.footer, **colors)
|
||||
)
|
||||
|
||||
assert expected == formatter.format(caplog.records[0])
|
||||
@@ -96,8 +110,13 @@ class TestColorFormatter:
|
||||
"{red}ERROR{nc}: description\n"
|
||||
"{red}{line}{nc}\n"
|
||||
"{stack_trace}"
|
||||
"{red}{line}{nc}\n".format(
|
||||
line="-" * 60, stack_trace=stack_trace, **colors
|
||||
"{red}{line}{nc}\n"
|
||||
"\n"
|
||||
"{footer}".format(
|
||||
footer=formatter.footer,
|
||||
line="-" * 60,
|
||||
stack_trace=stack_trace,
|
||||
**colors
|
||||
)
|
||||
)
|
||||
|
||||
@@ -119,7 +138,10 @@ class TestColorFormatter:
|
||||
"{red}ERROR{nc}: message - second: first\n"
|
||||
"{red}{line}{nc}\n"
|
||||
"{stack_trace}"
|
||||
"{red}{line}{nc}\n".format(
|
||||
"{red}{line}{nc}\n"
|
||||
"\n"
|
||||
"{footer}".format(
|
||||
footer=formatter.footer,
|
||||
line="-" * 60,
|
||||
stack_trace="\n".join([first_traceback, second_traceback]),
|
||||
**colors
|
||||
|
||||
@@ -14,7 +14,6 @@ from dvc.utils.fs import (
|
||||
contains_symlink_up_to,
|
||||
BasePathNotInCheckedPathException,
|
||||
get_parent_dirs_up_to,
|
||||
get_inode,
|
||||
)
|
||||
from mock import patch
|
||||
from tests.basic_env import TestDir
|
||||
@@ -150,20 +149,3 @@ def test_relpath_windows_different_drives():
|
||||
rel_info = relpath(info1, info2)
|
||||
assert isinstance(rel_info, str)
|
||||
assert rel_info == path1
|
||||
|
||||
|
||||
def test_get_inode(repo_dir):
|
||||
path = repo_dir.FOO
|
||||
path_info = PathInfo(path)
|
||||
assert get_inode(path) == get_inode(path_info)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", [TestDir.DATA, TestDir.DATA_DIR])
|
||||
def test_path_object_and_str_are_valid_types_get_mtime_and_size(
|
||||
path, repo_dir
|
||||
):
|
||||
dvcignore = DvcIgnoreFilter(repo_dir.root_dir)
|
||||
time, size = get_mtime_and_size(path, dvcignore)
|
||||
object_time, object_size = get_mtime_and_size(PathInfo(path), dvcignore)
|
||||
assert time == object_time
|
||||
assert size == object_size
|
||||
|
||||
Reference in New Issue
Block a user