mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 07:18:31 +01:00
lint: isort pre-commit & misc improvements (#3749)
* test: clean flake8 config root clutter * test: pre-commit: add isort Compatible with black (see https://github.com/timothycrosley/isort/issues/694) * lint: reorder imports * lint: more complex imports * lint: fix deepsource * config: isort: add first party dvc * tests: restyled: add isort * temp commit to revert before merge * Revert "temp commit to revert before merge" This reverts commit 11db0fd8e95fe891597cbb9bf804480909b19e24.
This commit is contained in:
@@ -2,7 +2,6 @@ import os
|
||||
import sys
|
||||
from subprocess import check_call
|
||||
|
||||
|
||||
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
os.chdir(REPO_ROOT)
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ from git.exc import GitCommandNotFound
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.utils.fs import remove
|
||||
|
||||
|
||||
logger = logging.getLogger("dvc")
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -5,8 +5,8 @@ import pytest
|
||||
|
||||
from dvc.remote.ssh.connection import SSHConnection
|
||||
from tests.utils.httpd import PushRequestHandler, StaticFileServer
|
||||
from .dir_helpers import * # noqa
|
||||
|
||||
from .dir_helpers import * # noqa
|
||||
|
||||
# Prevent updater and analytics from running their processes
|
||||
os.environ["DVC_TEST"] = "true"
|
||||
|
||||
@@ -50,10 +50,9 @@ from contextlib import contextmanager
|
||||
import pytest
|
||||
from funcy import lmap, retry
|
||||
|
||||
from dvc.compat import fspath, fspath_py35
|
||||
from dvc.logger import disable_other_loggers
|
||||
from dvc.utils.fs import makedirs
|
||||
from dvc.compat import fspath, fspath_py35
|
||||
|
||||
|
||||
__all__ = [
|
||||
"make_tmp_dir",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
|
||||
@@ -7,15 +7,16 @@ import time
|
||||
|
||||
import colorama
|
||||
import pytest
|
||||
from mock import patch, call
|
||||
from mock import call, patch
|
||||
|
||||
import dvc as dvc_module
|
||||
from dvc.cache import Cache
|
||||
from dvc.compat import fspath
|
||||
from dvc.dvcfile import DVC_FILE_SUFFIX
|
||||
from dvc.exceptions import (
|
||||
DvcException,
|
||||
OverlappingOutputPathsError,
|
||||
OutputDuplicationError,
|
||||
OverlappingOutputPathsError,
|
||||
RecursiveAddingWhileUsingFilename,
|
||||
StageFileCorruptedError,
|
||||
)
|
||||
@@ -25,10 +26,7 @@ from dvc.remote import LocalRemote
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.stage import Stage
|
||||
from dvc.system import System
|
||||
from dvc.utils import file_md5
|
||||
from dvc.utils import LARGE_DIR_SIZE
|
||||
from dvc.utils import relpath
|
||||
from dvc.compat import fspath
|
||||
from dvc.utils import LARGE_DIR_SIZE, file_md5, relpath
|
||||
from dvc.utils.fs import path_isin
|
||||
from dvc.utils.stage import load_stage_file
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import mock
|
||||
|
||||
from dvc.analytics import _scm_in_use
|
||||
from dvc.main import main
|
||||
from dvc.compat import fspath
|
||||
from dvc.main import main
|
||||
from dvc.repo import Repo
|
||||
|
||||
|
||||
|
||||
@@ -9,9 +9,7 @@ from dvc.exceptions import FileMissingError
|
||||
from dvc.main import main
|
||||
from dvc.path_info import URLInfo
|
||||
from dvc.utils.fs import remove
|
||||
|
||||
from tests.remotes import Azure, GCP, HDFS, Local, OSS, S3, SSH
|
||||
|
||||
from tests.remotes import GCP, HDFS, OSS, S3, SSH, Azure, Local
|
||||
|
||||
remote_params = [S3, GCP, Azure, OSS, SSH, HDFS]
|
||||
all_remote_params = [Local] + remote_params
|
||||
|
||||
+12
-12
@@ -7,29 +7,29 @@ import shutil
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
from dvc.exceptions import CheckoutError
|
||||
from dvc.exceptions import CheckoutErrorSuggestGit
|
||||
from dvc.exceptions import ConfirmRemoveError
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.dvcfile import DVC_FILE_SUFFIX, Dvcfile
|
||||
from dvc.exceptions import (
|
||||
CheckoutError,
|
||||
CheckoutErrorSuggestGit,
|
||||
ConfirmRemoveError,
|
||||
DvcException,
|
||||
)
|
||||
from dvc.main import main
|
||||
from dvc.remote import S3Remote
|
||||
from dvc.remote.local import LocalRemote
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.stage import Stage
|
||||
from dvc.dvcfile import Dvcfile, DVC_FILE_SUFFIX
|
||||
from dvc.stage.exceptions import (
|
||||
StageFileDoesNotExistError,
|
||||
StageFileBadNameError,
|
||||
StageFileDoesNotExistError,
|
||||
)
|
||||
from dvc.system import System
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.fs import walk_files
|
||||
from dvc.utils.stage import dump_stage_file
|
||||
from dvc.utils.stage import load_stage_file
|
||||
from dvc.remote import S3Remote
|
||||
from tests.remotes import S3
|
||||
from tests.basic_env import TestDvc
|
||||
from tests.basic_env import TestDvcGit
|
||||
from dvc.utils.stage import dump_stage_file, load_stage_file
|
||||
from tests.basic_env import TestDvc, TestDvcGit
|
||||
from tests.func.test_repro import TestRepro
|
||||
from tests.remotes import S3
|
||||
|
||||
logger = logging.getLogger("dvc")
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ from dvc.command.add import CmdAdd
|
||||
from dvc.command.base import CmdBase
|
||||
from dvc.command.checkout import CmdCheckout
|
||||
from dvc.command.config import CmdConfig
|
||||
from dvc.command.data_sync import CmdDataPull
|
||||
from dvc.command.data_sync import CmdDataPush
|
||||
from dvc.command.data_sync import CmdDataPull, CmdDataPush
|
||||
from dvc.command.gc import CmdGC
|
||||
from dvc.command.init import CmdInit
|
||||
from dvc.command.remove import CmdRemove
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from dvc.stage.exceptions import StageCommitError
|
||||
from dvc.utils.stage import dump_stage_file
|
||||
from dvc.utils.stage import load_stage_file
|
||||
from dvc.utils.stage import dump_stage_file, load_stage_file
|
||||
|
||||
|
||||
def test_commit_recursive(tmp_dir, dvc):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import pytest
|
||||
import configobj
|
||||
import pytest
|
||||
|
||||
from dvc.main import main
|
||||
from dvc.config import Config, ConfigError
|
||||
from dvc.main import main
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
|
||||
|
||||
@@ -7,40 +7,41 @@ from unittest import SkipTest
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.compat import fspath, fspath_py35
|
||||
from dvc.cache import NamedCache
|
||||
from dvc.compat import fspath, fspath_py35
|
||||
from dvc.data_cloud import DataCloud
|
||||
from dvc.external_repo import clean_repos
|
||||
from dvc.main import main
|
||||
from dvc.remote import AzureRemote
|
||||
from dvc.remote import GDriveRemote
|
||||
from dvc.remote import GSRemote
|
||||
from dvc.remote import HDFSRemote
|
||||
from dvc.remote import HTTPRemote
|
||||
from dvc.remote import LocalRemote
|
||||
from dvc.remote import OSSRemote
|
||||
from dvc.remote import S3Remote
|
||||
from dvc.remote import SSHRemote
|
||||
from dvc.remote import (
|
||||
AzureRemote,
|
||||
GDriveRemote,
|
||||
GSRemote,
|
||||
HDFSRemote,
|
||||
HTTPRemote,
|
||||
LocalRemote,
|
||||
OSSRemote,
|
||||
S3Remote,
|
||||
SSHRemote,
|
||||
)
|
||||
from dvc.remote.base import STATUS_DELETED, STATUS_NEW, STATUS_OK
|
||||
from dvc.stage.exceptions import StageNotFound
|
||||
from dvc.utils import file_md5
|
||||
from dvc.utils.fs import remove
|
||||
from dvc.utils.stage import dump_stage_file, load_stage_file
|
||||
from dvc.external_repo import clean_repos
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
from tests.remotes import (
|
||||
Azure,
|
||||
GCP,
|
||||
GDrive,
|
||||
HDFS,
|
||||
HTTP,
|
||||
Local,
|
||||
S3,
|
||||
SSHMocked,
|
||||
OSS,
|
||||
S3,
|
||||
TEST_CONFIG,
|
||||
TEST_GCP_CREDS_FILE,
|
||||
TEST_REMOTE,
|
||||
Azure,
|
||||
GDrive,
|
||||
Local,
|
||||
SSHMocked,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@ import copy
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.dependency import _get
|
||||
from dvc.dependency import DEP_MAP
|
||||
from dvc.dependency import DEP_MAP, _get
|
||||
from dvc.stage import Stage
|
||||
from tests.func.test_output import TESTS as OUT_TESTS
|
||||
|
||||
|
||||
TESTS = copy.copy(OUT_TESTS)
|
||||
TESTS.append(("http://example.com/path/to/file", "http"))
|
||||
TESTS.append(("https://example.com/path/to/file", "https"))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import hashlib
|
||||
import os
|
||||
import pytest
|
||||
|
||||
import pytest
|
||||
from funcy import first
|
||||
|
||||
from dvc.compat import fspath
|
||||
from dvc.utils.fs import remove
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.utils.fs import remove
|
||||
|
||||
|
||||
def digest(text):
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import pytest
|
||||
|
||||
from dvc.dvcfile import Dvcfile, PIPELINE_FILE
|
||||
from dvc.stage.loader import StageNotFound
|
||||
from dvc.dvcfile import PIPELINE_FILE, Dvcfile
|
||||
from dvc.stage.exceptions import (
|
||||
StageFileDoesNotExistError,
|
||||
StageNameUnspecified,
|
||||
)
|
||||
from dvc.stage.loader import StageNotFound
|
||||
|
||||
|
||||
def test_run_load_one_for_multistage(tmp_dir, dvc):
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import os
|
||||
|
||||
from mock import patch
|
||||
from dvc.compat import fspath
|
||||
|
||||
from dvc.compat import fspath
|
||||
from dvc.external_repo import external_repo
|
||||
from dvc.scm.git import Git
|
||||
from dvc.remote import LocalRemote
|
||||
from dvc.scm.git import Git
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.fs import remove
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import stat
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.utils.fs import makedirs, copyfile
|
||||
from dvc.utils.fs import copyfile, makedirs
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == "nt", reason="Not supported for Windows.")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
import shutil
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import configobj
|
||||
import pytest
|
||||
@@ -9,8 +9,8 @@ from git import Repo
|
||||
from dvc.compat import fspath
|
||||
from dvc.exceptions import CollectCacheError
|
||||
from dvc.main import main
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.remote.local import LocalRemote
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.utils.fs import remove
|
||||
from tests.basic_env import TestDir, TestDvcGit
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import os
|
||||
import pytest
|
||||
|
||||
from dvc.cache import Cache
|
||||
from dvc.main import main
|
||||
from dvc.compat import fspath
|
||||
from dvc.exceptions import PathMissingError
|
||||
from dvc.repo.get import GetDVCFileError
|
||||
from dvc.main import main
|
||||
from dvc.repo import Repo
|
||||
from dvc.repo.get import GetDVCFileError
|
||||
from dvc.system import System
|
||||
from dvc.utils.fs import makedirs
|
||||
from dvc.compat import fspath
|
||||
from tests.utils import trees_equal
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# encoding: utf-8
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.compat import fspath, fspath_py35
|
||||
from dvc.exceptions import DvcIgnoreInCollectedDirError
|
||||
from dvc.ignore import (
|
||||
DvcIgnore,
|
||||
@@ -10,12 +12,10 @@ from dvc.ignore import (
|
||||
DvcIgnorePatterns,
|
||||
DvcIgnoreRepo,
|
||||
)
|
||||
from dvc.remote import LocalRemote
|
||||
from dvc.scm.tree import WorkingTree
|
||||
from dvc.utils import relpath
|
||||
from dvc.compat import fspath_py35, fspath
|
||||
from dvc.utils.fs import get_mtime_and_size
|
||||
from dvc.remote import LocalRemote
|
||||
|
||||
from tests.dir_helpers import TmpDir
|
||||
from tests.utils import to_posixpath
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import filecmp
|
||||
import os
|
||||
from dvc.compat import fspath
|
||||
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
import dvc.data_cloud as cloud
|
||||
from dvc.cache import Cache
|
||||
from dvc.exceptions import DownloadError, PathMissingError
|
||||
from dvc.compat import fspath
|
||||
from dvc.config import NoRemoteError
|
||||
from dvc.dvcfile import Dvcfile
|
||||
from dvc.exceptions import DownloadError, PathMissingError
|
||||
from dvc.system import System
|
||||
from dvc.utils.fs import makedirs, remove
|
||||
import dvc.data_cloud as cloud
|
||||
from tests.utils import trees_equal
|
||||
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.stage import Stage
|
||||
from dvc.main import main
|
||||
from dvc.utils.fs import makedirs
|
||||
from dvc.compat import fspath
|
||||
from dvc.main import main
|
||||
from dvc.stage import Stage
|
||||
from dvc.utils.fs import makedirs
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ from dvc.config import Config
|
||||
from dvc.exceptions import InitError
|
||||
from dvc.main import main
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from tests.basic_env import TestDir
|
||||
from tests.basic_env import TestGit
|
||||
from tests.basic_env import TestDir, TestGit
|
||||
|
||||
|
||||
class TestInit(TestGit):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import os
|
||||
|
||||
from dvc.lock import Lock
|
||||
from dvc.lock import LockError
|
||||
from dvc.lock import Lock, LockError
|
||||
from dvc.main import main
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
|
||||
@@ -4,14 +4,13 @@ from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from dvc.dvcfile import PIPELINE_LOCK
|
||||
from dvc.serialize import get_params_deps
|
||||
from dvc.utils.fs import remove
|
||||
from dvc.utils.stage import parse_stage_for_update
|
||||
|
||||
from tests.func.test_run_multistage import supported_params
|
||||
|
||||
|
||||
FS_STRUCTURE = {
|
||||
"foo": "bar\nfoobar",
|
||||
"bar": "foo\nfoobar",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.compat import fspath
|
||||
from dvc.exceptions import PathMissingError
|
||||
from dvc.scm.base import CloneError
|
||||
from dvc.repo import Repo
|
||||
from dvc.scm.base import CloneError
|
||||
|
||||
FS_STRUCTURE = {
|
||||
"README.md": "content",
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import os
|
||||
|
||||
from dvc.dvcfile import DVC_FILE_SUFFIX
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.exceptions import MoveNotDataSourceError
|
||||
from dvc.exceptions import DvcException, MoveNotDataSourceError
|
||||
from dvc.main import main
|
||||
from dvc.utils.stage import load_stage_file
|
||||
from tests.basic_env import TestDvc
|
||||
from tests.basic_env import TestDvcGit
|
||||
from tests.basic_env import TestDvc, TestDvcGit
|
||||
from tests.func.test_repro import TestRepro
|
||||
from tests.utils import cd
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import pytest
|
||||
|
||||
from dvc.output import _get
|
||||
from dvc.output import OUTS_MAP
|
||||
from dvc.output import OUTS_MAP, _get
|
||||
from dvc.stage import Stage
|
||||
|
||||
|
||||
TESTS = [
|
||||
("s3://bucket/path", "s3"),
|
||||
("gs://bucket/path", "gs"),
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import logging
|
||||
|
||||
from dvc.command.pipeline import CmdPipelineList, CmdPipelineShow
|
||||
from dvc.main import main
|
||||
from dvc.command.pipeline import CmdPipelineShow, CmdPipelineList
|
||||
from tests.basic_env import TestDvc
|
||||
from tests.func.test_repro import TestRepro
|
||||
from tests.func.test_repro import TestReproChangedDeepData
|
||||
from tests.func.test_repro import TestRepro, TestReproChangedDeepData
|
||||
|
||||
|
||||
class TestPipelineShowSingle(TestDvc):
|
||||
|
||||
@@ -6,21 +6,21 @@ from collections import OrderedDict
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
from bs4 import BeautifulSoup
|
||||
from funcy import first
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from dvc.compat import fspath
|
||||
from dvc.repo.plot import NoDataOrTemplateProvided
|
||||
from dvc.repo.plot.data import (
|
||||
NoMetricInHistoryError,
|
||||
PlotMetricTypeError,
|
||||
PlotData,
|
||||
PlotMetricTypeError,
|
||||
)
|
||||
from dvc.repo.plot.template import (
|
||||
TemplateNotFoundError,
|
||||
NoDataForTemplateError,
|
||||
NoFieldInDataError,
|
||||
TemplateNotFoundError,
|
||||
)
|
||||
from dvc.repo.plot import NoDataOrTemplateProvided
|
||||
|
||||
|
||||
def _remove_whitespace(value):
|
||||
|
||||
@@ -5,13 +5,13 @@ import configobj
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
from dvc.compat import fspath
|
||||
from dvc.config import Config
|
||||
from dvc.exceptions import DownloadError, UploadError
|
||||
from dvc.main import main
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.remote import LocalRemote
|
||||
from dvc.remote.base import BaseRemote, RemoteCacheRequiredError
|
||||
from dvc.compat import fspath
|
||||
from dvc.utils.fs import remove
|
||||
from tests.basic_env import TestDvc
|
||||
from tests.remotes import Local
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import os
|
||||
|
||||
from dvc.cache import Cache
|
||||
from dvc.compat import fspath
|
||||
from dvc.repo import Repo
|
||||
from dvc.system import System
|
||||
from dvc.compat import fspath
|
||||
|
||||
|
||||
def test_destroy(tmp_dir, dvc, run_copy):
|
||||
|
||||
+13
-14
@@ -6,10 +6,9 @@ import re
|
||||
import shutil
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
from subprocess import PIPE
|
||||
from subprocess import Popen
|
||||
from urllib.parse import urljoin
|
||||
from subprocess import PIPE, Popen
|
||||
from unittest import SkipTest
|
||||
from urllib.parse import urljoin
|
||||
|
||||
import boto3
|
||||
import paramiko
|
||||
@@ -19,35 +18,35 @@ from google.cloud import storage as gc
|
||||
from mock import patch
|
||||
|
||||
from dvc.compat import fspath
|
||||
from dvc.exceptions import CyclicGraphError
|
||||
from dvc.exceptions import ReproductionError
|
||||
from dvc.exceptions import StagePathAsOutputError
|
||||
from dvc.dvcfile import DVC_FILE, Dvcfile
|
||||
from dvc.exceptions import (
|
||||
CyclicGraphError,
|
||||
ReproductionError,
|
||||
StagePathAsOutputError,
|
||||
)
|
||||
from dvc.main import main
|
||||
from dvc.output.base import BaseOutput
|
||||
from dvc.path_info import URLInfo
|
||||
from dvc.remote.local import LocalRemote
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.stage import Stage
|
||||
from dvc.dvcfile import Dvcfile, DVC_FILE
|
||||
from dvc.stage.exceptions import StageFileDoesNotExistError
|
||||
from dvc.system import System
|
||||
from dvc.utils import file_md5
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.stage import dump_stage_file
|
||||
from dvc.utils.stage import load_stage_file
|
||||
from dvc.utils import file_md5, relpath
|
||||
from dvc.utils.fs import remove
|
||||
from dvc.utils.stage import dump_stage_file, load_stage_file
|
||||
from tests.basic_env import TestDvc
|
||||
from tests.remotes import (
|
||||
GCP,
|
||||
HDFS,
|
||||
Local,
|
||||
S3,
|
||||
SSH,
|
||||
SSHMocked,
|
||||
TEST_AWS_REPO_BUCKET,
|
||||
TEST_GCP_REPO_BUCKET,
|
||||
Local,
|
||||
SSHMocked,
|
||||
)
|
||||
from tests.utils.httpd import StaticFileServer, ContentMD5Handler
|
||||
from tests.utils.httpd import ContentMD5Handler, StaticFileServer
|
||||
|
||||
|
||||
class SingleStageRun:
|
||||
|
||||
@@ -8,14 +8,11 @@ from funcy import lsplit
|
||||
|
||||
from dvc.dvcfile import PIPELINE_FILE, PIPELINE_LOCK
|
||||
from dvc.exceptions import CyclicGraphError
|
||||
from dvc.main import main
|
||||
from dvc.stage import PipelineStage
|
||||
from dvc.utils.stage import dump_stage_file, parse_stage
|
||||
|
||||
from tests.func import test_repro
|
||||
|
||||
from dvc.main import main
|
||||
|
||||
|
||||
COPY_SCRIPT_FORMAT = dedent(
|
||||
"""\
|
||||
import sys
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
import os
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from dvc.stage.exceptions import InvalidStageName, DuplicateStageName
|
||||
from dvc.stage.exceptions import DuplicateStageName, InvalidStageName
|
||||
|
||||
|
||||
def test_run_with_name(tmp_dir, dvc, run_copy):
|
||||
|
||||
@@ -8,13 +8,15 @@ import mock
|
||||
import pytest
|
||||
|
||||
from dvc.dependency.base import DependencyIsStageFileError
|
||||
from dvc.exceptions import ArgumentDuplicationError
|
||||
from dvc.exceptions import CircularDependencyError
|
||||
from dvc.exceptions import CyclicGraphError
|
||||
from dvc.exceptions import OutputDuplicationError
|
||||
from dvc.exceptions import OverlappingOutputPathsError
|
||||
from dvc.exceptions import StagePathAsOutputError
|
||||
from dvc.dvcfile import DVC_FILE_SUFFIX
|
||||
from dvc.exceptions import (
|
||||
ArgumentDuplicationError,
|
||||
CircularDependencyError,
|
||||
CyclicGraphError,
|
||||
OutputDuplicationError,
|
||||
OverlappingOutputPathsError,
|
||||
StagePathAsOutputError,
|
||||
)
|
||||
from dvc.main import main
|
||||
from dvc.output import BaseOutput
|
||||
from dvc.output.base import OutputIsStageFileError
|
||||
@@ -23,9 +25,9 @@ from dvc.stage import Stage
|
||||
from dvc.stage.exceptions import (
|
||||
StageFileAlreadyExistsError,
|
||||
StageFileBadNameError,
|
||||
StagePathOutsideError,
|
||||
StagePathNotFoundError,
|
||||
StagePathNotDirectoryError,
|
||||
StagePathNotFoundError,
|
||||
StagePathOutsideError,
|
||||
)
|
||||
from dvc.system import System
|
||||
from dvc.utils import file_md5
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
from functools import wraps
|
||||
|
||||
import boto3
|
||||
import moto.s3.models as s3model
|
||||
import pytest
|
||||
from moto import mock_s3
|
||||
|
||||
import moto.s3.models as s3model
|
||||
from dvc.remote.s3 import S3Remote
|
||||
from moto import mock_s3
|
||||
from tests.remotes import S3
|
||||
|
||||
|
||||
# from https://github.com/spulec/moto/blob/v1.3.5/tests/test_s3/test_s3.py#L40
|
||||
REDUCED_PART_SIZE = 256
|
||||
|
||||
|
||||
@@ -3,14 +3,11 @@ import os
|
||||
import pytest
|
||||
from git import Repo
|
||||
|
||||
from dvc.scm import Git
|
||||
from dvc.scm import NoSCM
|
||||
from dvc.scm import SCM
|
||||
from dvc.compat import fspath
|
||||
from dvc.scm import SCM, Git, NoSCM
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.system import System
|
||||
from dvc.compat import fspath
|
||||
from tests.basic_env import TestGit
|
||||
from tests.basic_env import TestGitSubmodule
|
||||
from tests.basic_env import TestGit, TestGitSubmodule
|
||||
from tests.utils import get_gitignore_content
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.dvcfile import SingleStageFile
|
||||
from dvc.main import main
|
||||
from dvc.output.local import LocalOutput
|
||||
from dvc.remote.local import LocalRemote
|
||||
from dvc.repo import Repo
|
||||
from dvc.stage import Stage
|
||||
from dvc.dvcfile import SingleStageFile
|
||||
from dvc.stage.exceptions import StageFileFormatError
|
||||
from dvc.utils.stage import dump_stage_file
|
||||
from dvc.utils.stage import load_stage_file
|
||||
from dvc.utils.stage import dump_stage_file, load_stage_file
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import mock
|
||||
import os
|
||||
|
||||
import mock
|
||||
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.state import State
|
||||
from dvc.utils import file_md5
|
||||
|
||||
@@ -2,8 +2,8 @@ import os
|
||||
|
||||
from mock import patch
|
||||
|
||||
from dvc.main import main
|
||||
from dvc.compat import fspath
|
||||
from dvc.main import main
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ from dvc.ignore import CleanTree
|
||||
from dvc.scm import SCM
|
||||
from dvc.scm.git import GitTree
|
||||
from dvc.scm.tree import WorkingTree
|
||||
from tests.basic_env import TestDir
|
||||
from tests.basic_env import TestGit
|
||||
from tests.basic_env import TestGitSubmodule
|
||||
from tests.basic_env import TestDir, TestGit, TestGitSubmodule
|
||||
|
||||
|
||||
class TestWorkingTree(TestDir):
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import pytest
|
||||
import os
|
||||
|
||||
from dvc.dvcfile import Dvcfile
|
||||
import pytest
|
||||
|
||||
from dvc.compat import fspath, fspath_py35
|
||||
from dvc.dvcfile import Dvcfile
|
||||
|
||||
|
||||
@pytest.mark.parametrize("cached", [True, False])
|
||||
|
||||
+4
-7
@@ -1,19 +1,16 @@
|
||||
import getpass
|
||||
import os
|
||||
import platform
|
||||
import uuid
|
||||
import getpass
|
||||
|
||||
from contextlib import contextmanager
|
||||
from subprocess import CalledProcessError, check_output, Popen
|
||||
from subprocess import CalledProcessError, Popen, check_output
|
||||
|
||||
from dvc.utils import env2bool
|
||||
from dvc.remote import GDriveRemote
|
||||
from dvc.remote.gs import GSRemote
|
||||
from dvc.remote.s3 import S3Remote
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
from dvc.utils import env2bool
|
||||
from moto.s3 import mock_s3
|
||||
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
TEST_REMOTE = "upstream"
|
||||
TEST_CONFIG = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import collections
|
||||
import os
|
||||
import logging
|
||||
import os
|
||||
|
||||
from dvc.cli import parse_args
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from dvc.cli import parse_args
|
||||
from dvc.command.metrics import CmdMetricsDiff, _show_diff, CmdMetricsShow
|
||||
from dvc.command.metrics import CmdMetricsDiff, CmdMetricsShow, _show_diff
|
||||
|
||||
|
||||
def test_metrics_diff(dvc, mocker):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from dvc.cli import parse_args
|
||||
from dvc.command.plot import CmdPlotShow, CmdPlotDiff
|
||||
from dvc.command.plot import CmdPlotDiff, CmdPlotShow
|
||||
|
||||
|
||||
def test_metrics_diff(mocker):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
|
||||
from dvc.cli import parse_args
|
||||
from dvc.command.update import CmdUpdate
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.dependency import ParamsDependency, loads_params, loadd_from
|
||||
from dvc.dependency import ParamsDependency, loadd_from, loads_params
|
||||
from dvc.dependency.param import BadParamFileError, MissingParamsError
|
||||
from dvc.stage import Stage
|
||||
|
||||
|
||||
PARAMS = {
|
||||
"foo": 1,
|
||||
"bar": 53.135,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
|
||||
from mock import patch
|
||||
|
||||
from dvc.output import LocalOutput
|
||||
from dvc.remote.local import LocalRemote
|
||||
from dvc.stage import Stage
|
||||
|
||||
@@ -2,8 +2,7 @@ import logging
|
||||
|
||||
import pytest
|
||||
from funcy import first
|
||||
|
||||
from voluptuous import Schema, MultipleInvalid
|
||||
from voluptuous import MultipleInvalid, Schema
|
||||
|
||||
from dvc.cache import NamedCache
|
||||
from dvc.output import CHECKSUM_SCHEMA, BaseOutput
|
||||
|
||||
@@ -9,7 +9,6 @@ import pytest
|
||||
from dvc.command.version import CmdVersion
|
||||
from dvc.system import System
|
||||
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from mock import mock_open
|
||||
from mock import patch
|
||||
from mock import mock_open, patch
|
||||
|
||||
from dvc.remote.ssh import SSHRemote
|
||||
from dvc.system import System
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from dvc.remote.azure import AzureRemote
|
||||
|
||||
|
||||
container_name = "container-name"
|
||||
connection_string = (
|
||||
"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;"
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import math
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.remote.base import BaseRemote
|
||||
from dvc.remote.base import RemoteCmdError
|
||||
from dvc.remote.base import RemoteMissingDepsError
|
||||
from dvc.remote.base import BaseRemote, RemoteCmdError, RemoteMissingDepsError
|
||||
|
||||
|
||||
class _CallableOrNone(object):
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import pytest
|
||||
import os
|
||||
|
||||
from dvc.remote.gdrive import GDriveRemote, GDriveAuthError
|
||||
import pytest
|
||||
|
||||
from dvc.remote.gdrive import GDriveAuthError, GDriveRemote
|
||||
|
||||
USER_CREDS_TOKEN_REFRESH_ERROR = '{"access_token": "", "client_id": "", "client_secret": "", "refresh_token": "", "token_expiry": "", "token_uri": "https://oauth2.googleapis.com/token", "user_agent": null, "revoke_uri": "https://oauth2.googleapis.com/revoke", "id_token": null, "id_token_jwt": null, "token_response": {"access_token": "", "expires_in": 3600, "scope": "https://www.googleapis.com/auth/drive.appdata https://www.googleapis.com/auth/drive", "token_type": "Bearer"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.appdata"], "token_info_uri": "https://oauth2.googleapis.com/tokeninfo", "invalid": true, "_class": "OAuth2Credentials", "_module": "oauth2client.client"}' # noqa: E501
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ import mock
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from dvc.remote.gs import dynamic_chunk_size
|
||||
from dvc.remote.gs import GSRemote
|
||||
|
||||
from dvc.remote.gs import GSRemote, dynamic_chunk_size
|
||||
|
||||
BUCKET = "bucket"
|
||||
PREFIX = "prefix"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
import errno
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from dvc.remote.oss import OSSRemote
|
||||
|
||||
|
||||
bucket_name = "bucket-name"
|
||||
endpoint = "endpoint"
|
||||
key_id = "Fq2UVErCz4I6tq"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from dvc.remote import Remote, S3Remote, GSRemote
|
||||
from dvc.remote import GSRemote, Remote, S3Remote
|
||||
|
||||
|
||||
def test_remote_with_checksum_jobs(dvc):
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.remote.s3 import S3Remote
|
||||
from dvc.utils.fs import walk_files
|
||||
from dvc.path_info import PathInfo
|
||||
from tests.remotes import GCP, S3Mocked
|
||||
|
||||
remotes = [GCP, S3Mocked]
|
||||
|
||||
@@ -3,7 +3,6 @@ import pytest
|
||||
from dvc.config import ConfigError
|
||||
from dvc.remote.s3 import S3Remote
|
||||
|
||||
|
||||
bucket_name = "bucket-name"
|
||||
prefix = "some/prefix"
|
||||
url = "s3://{}/{}".format(bucket_name, prefix)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
|
||||
from funcy import raiser
|
||||
import pytest
|
||||
from funcy import raiser
|
||||
|
||||
from dvc.repo import locked
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from dvc.repo.tree import DvcTree
|
||||
from dvc.compat import fspath_py35
|
||||
from dvc.repo.tree import DvcTree
|
||||
|
||||
|
||||
def test_exists(tmp_dir, dvc):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import os
|
||||
|
||||
from dvc.compat import fspath
|
||||
|
||||
from tests.basic_env import TestDvcGit
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
import mock
|
||||
import platform
|
||||
import json
|
||||
import platform
|
||||
|
||||
from voluptuous import Schema, Any
|
||||
import mock
|
||||
import pytest
|
||||
from voluptuous import Any, Schema
|
||||
|
||||
from dvc import analytics
|
||||
from dvc.cli import parse_args
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.config import Config
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from mock import MagicMock
|
||||
from mock import mock_open
|
||||
from mock import patch
|
||||
from mock import MagicMock, mock_open, patch
|
||||
|
||||
from dvc.ignore import DvcIgnoreDirs
|
||||
from dvc.ignore import DvcIgnorePatterns
|
||||
from dvc.ignore import DvcIgnoreDirs, DvcIgnorePatterns
|
||||
|
||||
|
||||
def mock_dvcignore(dvcignore_path, patterns):
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from dvc.stage import PipelineStage
|
||||
from dvc.dvcfile import Lockfile, LockfileCorruptedError
|
||||
import yaml
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from dvc.dvcfile import Lockfile, LockfileCorruptedError
|
||||
from dvc.stage import PipelineStage
|
||||
|
||||
|
||||
def test_stage_dump_no_outs_deps(tmp_dir, dvc):
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import logging
|
||||
import time
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
|
||||
import colorama
|
||||
|
||||
import dvc.logger
|
||||
import time
|
||||
from datetime import datetime
|
||||
import pytest
|
||||
|
||||
import dvc.logger
|
||||
from dvc.exceptions import DvcException
|
||||
|
||||
|
||||
logger = logging.getLogger("dvc")
|
||||
formatter = dvc.logger.ColorFormatter()
|
||||
colors = {
|
||||
|
||||
@@ -3,11 +3,7 @@ import pathlib
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.path_info import CloudURLInfo
|
||||
from dvc.path_info import HTTPURLInfo
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.path_info import URLInfo
|
||||
|
||||
from dvc.path_info import CloudURLInfo, HTTPURLInfo, PathInfo, URLInfo
|
||||
|
||||
TEST_DEPTH = len(pathlib.Path(__file__).parents) + 1
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from collections import OrderedDict
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.repo.plot.data import _apply_path, _lists, _find_data
|
||||
from dvc.repo.plot.data import _apply_path, _find_data, _lists
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -2,15 +2,15 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.rwlock import (
|
||||
rwlock,
|
||||
_edit_rwlock,
|
||||
RWLockFileFormatError,
|
||||
RWLockFileCorruptedError,
|
||||
)
|
||||
from dvc.lock import LockError
|
||||
from dvc.compat import fspath
|
||||
from dvc.lock import LockError
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.rwlock import (
|
||||
RWLockFileCorruptedError,
|
||||
RWLockFileFormatError,
|
||||
_edit_rwlock,
|
||||
rwlock,
|
||||
)
|
||||
|
||||
|
||||
def test_rwlock(tmp_path):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
|
||||
from dvc.state import _build_sqlite_uri
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -12,15 +12,18 @@ from dvc.path_info import PathInfo
|
||||
from dvc.scm.tree import WorkingTree
|
||||
from dvc.system import System
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.fs import BasePathNotInCheckedPathException
|
||||
from dvc.utils.fs import copyfile
|
||||
from dvc.utils.fs import contains_symlink_up_to
|
||||
from dvc.utils.fs import get_inode
|
||||
from dvc.utils.fs import get_mtime_and_size
|
||||
from dvc.utils.fs import move
|
||||
from dvc.utils.fs import path_isin, remove
|
||||
from dvc.utils.fs import makedirs
|
||||
from dvc.utils.fs import walk_files
|
||||
from dvc.utils.fs import (
|
||||
BasePathNotInCheckedPathException,
|
||||
contains_symlink_up_to,
|
||||
copyfile,
|
||||
get_inode,
|
||||
get_mtime_and_size,
|
||||
makedirs,
|
||||
move,
|
||||
path_isin,
|
||||
remove,
|
||||
walk_files,
|
||||
)
|
||||
from tests.basic_env import TestDir
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import re
|
||||
import os
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.utils import (
|
||||
file_md5,
|
||||
dict_sha256,
|
||||
resolve_output,
|
||||
file_md5,
|
||||
fix_env,
|
||||
relpath,
|
||||
to_chunks,
|
||||
tmp_fname,
|
||||
parse_target,
|
||||
relpath,
|
||||
resolve_output,
|
||||
tmp_fname,
|
||||
to_chunks,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
import threading
|
||||
from http import HTTPStatus
|
||||
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||
|
||||
from RangeHTTPServer import RangeRequestHandler
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user