migrate to pytest

This commit is contained in:
Ivan Shcheklein
2019-03-17 14:49:49 -07:00
parent a54eaeb59e
commit 75421f0f21
34 changed files with 29 additions and 31 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
azure-storage-blob==1.3.0 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 ply>=3.9 # See https://github.com/pyinstaller/pyinstaller/issues/1945
configparser>=3.5.0 configparser>=3.5.0
zc.lockfile>=1.2.1 zc.lockfile>=1.2.1
+1 -1
View File
@@ -26,7 +26,7 @@ install_requires = [
# Extra dependencies for remote integrations # Extra dependencies for remote integrations
gs = ["google-cloud-storage==1.13.0"] gs = ["google-cloud-storage==1.13.0"]
s3 = ["boto3==1.7.4"] s3 = ["boto3==1.9.115"]
azure = ["azure-storage-blob==1.3.0"] azure = ["azure-storage-blob==1.3.0"]
ssh = ["paramiko>=2.4.1"] ssh = ["paramiko>=2.4.1"]
all_remotes = gs + s3 + azure + ssh all_remotes = gs + s3 + azure + ssh
+4 -11
View File
@@ -13,18 +13,11 @@ os.putenv("DVC_HOME", REPO_ROOT)
os.putenv("DVC_TEST", "true") os.putenv("DVC_TEST", "true")
if len(sys.argv) == 1: if len(sys.argv) == 1:
scope = "--all-modules" params = ""
else: else:
scope = " ".join(sys.argv[1:]) params = " ".join(sys.argv[1:])
cmd = ( cmd = "py.test -v -n=4 --timeout=600 --cov=dvc " "{params} ".format(
"nosetests -v --processes=4 --process-timeout=600 --cover-inclusive " params=params
"--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)
) )
check_call(cmd, shell=True) check_call(cmd, shell=True)
+4 -4
View File
@@ -1,11 +1,11 @@
pytest>=3.3.1 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 flaky>=3.5.3
mock>=2.0.0 mock>=2.0.0
coverage>=4.5.1
codecov>=2.0.15
xmltodict>=0.11.0 xmltodict>=0.11.0
awscli>=1.14.18 awscli>=1.16.125
google-compute-engine google-compute-engine
pywin32; sys_platform == 'win32' pywin32; sys_platform == 'win32'
Pygments # required by collective.checkdocs Pygments # required by collective.checkdocs
+1 -1
View File
@@ -356,7 +356,7 @@ class TestCheckoutDirectory(TestRepro):
class TestCheckoutHook(TestDvc): class TestCheckoutHook(TestDvc):
@mock.patch("sys.stdout.isatty", return_value=True) @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): def test(self, mock_input, mock_isatty):
""" Test that dvc checkout handles EOFError gracefully, which is what """ Test that dvc checkout handles EOFError gracefully, which is what
it will experience when running in a git hook. it will experience when running in a git hook.
View File
@@ -1,6 +1,6 @@
from dvc.dependency.gs import DependencyGS from dvc.dependency.gs import DependencyGS
from tests.unit.dependency.local import TestDependencyLOCAL from tests.unit.dependency.test_local import TestDependencyLOCAL
class TestDependencyGS(TestDependencyLOCAL): class TestDependencyGS(TestDependencyLOCAL):
@@ -1,6 +1,6 @@
from dvc.dependency.hdfs import DependencyHDFS from dvc.dependency.hdfs import DependencyHDFS
from tests.unit.dependency.local import TestDependencyLOCAL from tests.unit.dependency.test_local import TestDependencyLOCAL
class TestDependencyHDFS(TestDependencyLOCAL): class TestDependencyHDFS(TestDependencyLOCAL):
@@ -1,6 +1,6 @@
from dvc.dependency.http import DependencyHTTP from dvc.dependency.http import DependencyHTTP
from tests.unit.dependency.local import TestDependencyLOCAL from tests.unit.dependency.test_local import TestDependencyLOCAL
class TestDependencyHTTP(TestDependencyLOCAL): class TestDependencyHTTP(TestDependencyLOCAL):
@@ -1,6 +1,6 @@
from dvc.dependency.s3 import DependencyS3 from dvc.dependency.s3 import DependencyS3
from tests.unit.dependency.local import TestDependencyLOCAL from tests.unit.dependency.test_local import TestDependencyLOCAL
class TestDependencyS3(TestDependencyLOCAL): class TestDependencyS3(TestDependencyLOCAL):
@@ -1,6 +1,6 @@
from dvc.dependency.ssh import DependencySSH from dvc.dependency.ssh import DependencySSH
from tests.unit.dependency.local import TestDependencyLOCAL from tests.unit.dependency.test_local import TestDependencyLOCAL
class TestDependencySSH(TestDependencyLOCAL): class TestDependencySSH(TestDependencyLOCAL):
@@ -1,6 +1,6 @@
from dvc.output.gs import OutputGS from dvc.output.gs import OutputGS
from tests.unit.output.local import TestOutputLOCAL from tests.unit.output.test_local import TestOutputLOCAL
class TestOutputGS(TestOutputLOCAL): class TestOutputGS(TestOutputLOCAL):
@@ -1,6 +1,6 @@
from dvc.output.hdfs import OutputHDFS from dvc.output.hdfs import OutputHDFS
from tests.unit.output.local import TestOutputLOCAL from tests.unit.output.test_local import TestOutputLOCAL
class TestOutputHDFS(TestOutputLOCAL): class TestOutputHDFS(TestOutputLOCAL):
@@ -1,6 +1,6 @@
from dvc.output.s3 import OutputS3 from dvc.output.s3 import OutputS3
from tests.unit.output.local import TestOutputLOCAL from tests.unit.output.test_local import TestOutputLOCAL
class TestOutputS3(TestOutputLOCAL): class TestOutputS3(TestOutputLOCAL):
@@ -1,6 +1,6 @@
from dvc.output.ssh import OutputSSH from dvc.output.ssh import OutputSSH
from tests.unit.output.local import TestOutputLOCAL from tests.unit.output.test_local import TestOutputLOCAL
class TestOutputSSH(TestOutputLOCAL): class TestOutputSSH(TestOutputLOCAL):
View File
View File
@@ -56,19 +56,24 @@ class TestContainsLink(TestCase):
def test_should_return_false_on_no_more_dirs_below_path( def test_should_return_false_on_no_more_dirs_below_path(
self, dirname_patch, _ 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() dirname_patch.assert_called_once()
@patch.object(System, "is_symlink", return_value=False) @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) contains_symlink_spy = spy(contains_symlink_up_to)
with patch.object( with patch.object(
dvc.utils.fs, "contains_symlink_up_to", contains_symlink_spy dvc.utils.fs, "contains_symlink_up_to", contains_symlink_spy
): ):
# call from full path to match contains_symlink_spy patch path # 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) self.assertEqual(2, contains_symlink_spy.mock.call_count)
@patch.object(System, "is_symlink", return_value=True) @patch.object(System, "is_symlink", return_value=True)