mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
migrate to pytest
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
azure-storage-blob==1.3.0
|
||||
boto3==1.9.86
|
||||
boto3==1.9.115
|
||||
ply>=3.9 # See https://github.com/pyinstaller/pyinstaller/issues/1945
|
||||
configparser>=3.5.0
|
||||
zc.lockfile>=1.2.1
|
||||
|
||||
@@ -26,7 +26,7 @@ install_requires = [
|
||||
|
||||
# Extra dependencies for remote integrations
|
||||
gs = ["google-cloud-storage==1.13.0"]
|
||||
s3 = ["boto3==1.7.4"]
|
||||
s3 = ["boto3==1.9.115"]
|
||||
azure = ["azure-storage-blob==1.3.0"]
|
||||
ssh = ["paramiko>=2.4.1"]
|
||||
all_remotes = gs + s3 + azure + ssh
|
||||
|
||||
+4
-11
@@ -13,18 +13,11 @@ os.putenv("DVC_HOME", REPO_ROOT)
|
||||
os.putenv("DVC_TEST", "true")
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
scope = "--all-modules"
|
||||
params = ""
|
||||
else:
|
||||
scope = " ".join(sys.argv[1:])
|
||||
params = " ".join(sys.argv[1:])
|
||||
|
||||
cmd = (
|
||||
"nosetests -v --processes=4 --process-timeout=600 --cover-inclusive "
|
||||
"--cover-erase --cover-package=dvc --with-coverage --with-flaky "
|
||||
"--logging-clear-handlers "
|
||||
# --exe ensures tests are executed even if they have exec permissions set
|
||||
# and owned by root:root as they do when running in Windows Subsystem for
|
||||
# Linux (WSL).
|
||||
"--exe "
|
||||
"{scope} ".format(scope=scope)
|
||||
cmd = "py.test -v -n=4 --timeout=600 --cov=dvc " "{params} ".format(
|
||||
params=params
|
||||
)
|
||||
check_call(cmd, shell=True)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
pytest>=3.3.1
|
||||
nose>=1.3.7
|
||||
pytest-timeout>=1.3.3
|
||||
pytest-cov>=2.6.1
|
||||
pytest-xdist>=1.26.1
|
||||
flaky>=3.5.3
|
||||
mock>=2.0.0
|
||||
coverage>=4.5.1
|
||||
codecov>=2.0.15
|
||||
xmltodict>=0.11.0
|
||||
awscli>=1.14.18
|
||||
awscli>=1.16.125
|
||||
google-compute-engine
|
||||
pywin32; sys_platform == 'win32'
|
||||
Pygments # required by collective.checkdocs
|
||||
|
||||
@@ -356,7 +356,7 @@ class TestCheckoutDirectory(TestRepro):
|
||||
|
||||
class TestCheckoutHook(TestDvc):
|
||||
@mock.patch("sys.stdout.isatty", return_value=True)
|
||||
@mock.patch("dvc.utils.compat.input", side_effect=EOFError)
|
||||
@mock.patch("dvc.prompt.input", side_effect=EOFError)
|
||||
def test(self, mock_input, mock_isatty):
|
||||
""" Test that dvc checkout handles EOFError gracefully, which is what
|
||||
it will experience when running in a git hook.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.dependency.gs import DependencyGS
|
||||
|
||||
from tests.unit.dependency.local import TestDependencyLOCAL
|
||||
from tests.unit.dependency.test_local import TestDependencyLOCAL
|
||||
|
||||
|
||||
class TestDependencyGS(TestDependencyLOCAL):
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.dependency.hdfs import DependencyHDFS
|
||||
|
||||
from tests.unit.dependency.local import TestDependencyLOCAL
|
||||
from tests.unit.dependency.test_local import TestDependencyLOCAL
|
||||
|
||||
|
||||
class TestDependencyHDFS(TestDependencyLOCAL):
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.dependency.http import DependencyHTTP
|
||||
|
||||
from tests.unit.dependency.local import TestDependencyLOCAL
|
||||
from tests.unit.dependency.test_local import TestDependencyLOCAL
|
||||
|
||||
|
||||
class TestDependencyHTTP(TestDependencyLOCAL):
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.dependency.s3 import DependencyS3
|
||||
|
||||
from tests.unit.dependency.local import TestDependencyLOCAL
|
||||
from tests.unit.dependency.test_local import TestDependencyLOCAL
|
||||
|
||||
|
||||
class TestDependencyS3(TestDependencyLOCAL):
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.dependency.ssh import DependencySSH
|
||||
|
||||
from tests.unit.dependency.local import TestDependencyLOCAL
|
||||
from tests.unit.dependency.test_local import TestDependencyLOCAL
|
||||
|
||||
|
||||
class TestDependencySSH(TestDependencyLOCAL):
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.output.gs import OutputGS
|
||||
|
||||
from tests.unit.output.local import TestOutputLOCAL
|
||||
from tests.unit.output.test_local import TestOutputLOCAL
|
||||
|
||||
|
||||
class TestOutputGS(TestOutputLOCAL):
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.output.hdfs import OutputHDFS
|
||||
|
||||
from tests.unit.output.local import TestOutputLOCAL
|
||||
from tests.unit.output.test_local import TestOutputLOCAL
|
||||
|
||||
|
||||
class TestOutputHDFS(TestOutputLOCAL):
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.output.s3 import OutputS3
|
||||
|
||||
from tests.unit.output.local import TestOutputLOCAL
|
||||
from tests.unit.output.test_local import TestOutputLOCAL
|
||||
|
||||
|
||||
class TestOutputS3(TestOutputLOCAL):
|
||||
@@ -1,6 +1,6 @@
|
||||
from dvc.output.ssh import OutputSSH
|
||||
|
||||
from tests.unit.output.local import TestOutputLOCAL
|
||||
from tests.unit.output.test_local import TestOutputLOCAL
|
||||
|
||||
|
||||
class TestOutputSSH(TestOutputLOCAL):
|
||||
@@ -56,19 +56,24 @@ class TestContainsLink(TestCase):
|
||||
def test_should_return_false_on_no_more_dirs_below_path(
|
||||
self, dirname_patch, _
|
||||
):
|
||||
self.assertFalse(contains_symlink_up_to("path"))
|
||||
self.assertFalse(
|
||||
contains_symlink_up_to(os.path.join("foo", "path"), "foo")
|
||||
)
|
||||
dirname_patch.assert_called_once()
|
||||
|
||||
@patch.object(System, "is_symlink", return_value=False)
|
||||
@patch.object(os.path, "dirname", return_value="")
|
||||
def test_should_call_recursive_on_no_condition_matched(self, _, __):
|
||||
def test_should_call_recursive_on_no_condition_matched(self, _):
|
||||
contains_symlink_spy = spy(contains_symlink_up_to)
|
||||
with patch.object(
|
||||
dvc.utils.fs, "contains_symlink_up_to", contains_symlink_spy
|
||||
):
|
||||
|
||||
# call from full path to match contains_symlink_spy patch path
|
||||
self.assertFalse(dvc.utils.fs.contains_symlink_up_to("path"))
|
||||
self.assertFalse(
|
||||
dvc.utils.fs.contains_symlink_up_to(
|
||||
os.path.join("foo", "path"), "foo"
|
||||
)
|
||||
)
|
||||
self.assertEqual(2, contains_symlink_spy.mock.call_count)
|
||||
|
||||
@patch.object(System, "is_symlink", return_value=True)
|
||||
Reference in New Issue
Block a user