Skip to content

Commit

Permalink
test: use helper remotes in external repro
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Jan 14, 2020
1 parent b865a48 commit 7993600
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions tests/func/test_repro.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from tests.remotes import (
GCP,
HDFS,
Local,
S3,
SSH,
SSHMocked,
Expand Down Expand Up @@ -807,7 +808,8 @@ def test(self):


class TestReproExternalBase(TestDvc):
def should_test(self):
@staticmethod
def should_test():
return False

@property
Expand Down Expand Up @@ -956,10 +958,7 @@ def test(self, mock_prompt):


@pytest.mark.skipif(os.name == "nt", reason="temporarily disabled on windows")
class TestReproExternalS3(TestReproExternalBase):
def should_test(self):
return S3.should_test()

class TestReproExternalS3(S3, TestReproExternalBase):
@property
def scheme(self):
return "s3"
Expand All @@ -976,10 +975,7 @@ def write(self, bucket, key, body):
s3.put_object(Bucket=bucket, Key=key, Body=body)


class TestReproExternalGS(TestReproExternalBase):
def should_test(self):
return GCP.should_test()

class TestReproExternalGS(GCP, TestReproExternalBase):
@property
def scheme(self):
return "gs"
Expand All @@ -997,10 +993,7 @@ def write(self, bucket, key, body):
bucket.blob(key).upload_from_string(body)


class TestReproExternalHDFS(TestReproExternalBase):
def should_test(self):
return HDFS.should_test()

class TestReproExternalHDFS(HDFS, TestReproExternalBase):
@property
def scheme(self):
return "hdfs"
Expand Down Expand Up @@ -1057,20 +1050,17 @@ def write(self, bucket, key, body):


@flaky(max_runs=3, min_passes=1)
class TestReproExternalSSH(TestReproExternalBase):
class TestReproExternalSSH(SSH, TestReproExternalBase):
_dir = None

def should_test(self):
return SSH.should_test()

@property
def scheme(self):
return "ssh"

@property
def bucket(self):
if not self._dir:
self._dir = TestDvc.mkdtemp()
self._dir = self.mkdtemp()
return "{}@127.0.0.1:{}".format(getpass.getuser(), self._dir)

def cmd(self, i, o):
Expand Down Expand Up @@ -1104,10 +1094,10 @@ def write(self, bucket, key, body):
fobj.write(body)


class TestReproExternalLOCAL(TestReproExternalBase):
class TestReproExternalLOCAL(Local, TestReproExternalBase):
def setUp(self):
super().setUp()
self.tmpdir = TestDvc.mkdtemp()
self.tmpdir = self.mkdtemp()
ret = main(["config", "cache.type", "hardlink"])
self.assertEqual(ret, 0)
self.dvc = DvcRepo(".")
Expand All @@ -1116,9 +1106,6 @@ def setUp(self):
def cache_type(self):
return "hardlink"

def should_test(self):
return True

@property
def cache_scheme(self):
return "local"
Expand Down

0 comments on commit 7993600

Please sign in to comment.