Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
p = Popen(
"hadoop fs -copyFromLocal {} {}".format("tmp", url),
shell=True,
executable=os.getenv("SHELL"),
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
)
out, err = p.communicate()
if p.returncode != 0:
print(out)
print(err)
self.assertEqual(p.returncode, 0)
@flaky(max_runs=3, min_passes=1)
class TestReproExternalSSH(TestReproExternalBase):
_dir = None
def should_test(self):
return _should_test_ssh()
@property
def scheme(self):
return "ssh"
@property
def bucket(self):
if not self._dir:
self._dir = TestDvc.mkdtemp()
return "{}@127.0.0.1:{}".format(getpass.getuser(), self._dir)
p = Popen(
"hadoop fs -copyFromLocal {} {}".format("tmp", url),
shell=True,
executable=os.getenv("SHELL"),
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
)
out, err = p.communicate()
if p.returncode != 0:
print(out)
print(err)
self.assertEqual(p.returncode, 0)
@flaky(max_runs=3, min_passes=1)
class TestReproExternalSSH(TestReproExternalBase):
_dir = None
def should_test(self):
return _should_test_ssh()
@property
def scheme(self):
return "ssh"
@property
def bucket(self):
if not self._dir:
self._dir = TestDvc.mkdtemp()
return "{}@127.0.0.1:{}".format(getpass.getuser(), self._dir)
lambda: flaky(max_runs=2, min_passes=3)(test_something),
)
def _expect_test_flaky(self, is_test_method, max_runs, min_passes):
self._expect_call_test_address()
if is_test_method:
mock_test_method = getattr(
self._mock_test,
self._mock_test_method_name
)
for flaky_attr in FlakyNames():
setattr(self._mock_test, flaky_attr, None)
setattr(mock_test_method, flaky_attr, None)
flaky(max_runs, min_passes)(mock_test_method)
else:
flaky(max_runs, min_passes)(self._mock_test)
mock_test_method = getattr(
self._mock_test,
self._mock_test_method_name
)
for flaky_attr in FlakyNames():
setattr(mock_test_method, flaky_attr, None)
def _expect_test_flaky(self, is_test_method, max_runs, min_passes):
self._expect_call_test_address()
if is_test_method:
mock_test_method = getattr(
self._mock_test,
self._mock_test_method_name
)
for flaky_attr in FlakyNames():
setattr(self._mock_test, flaky_attr, None)
setattr(mock_test_method, flaky_attr, None)
flaky(max_runs, min_passes)(mock_test_method)
else:
flaky(max_runs, min_passes)(self._mock_test)
mock_test_method = getattr(
self._mock_test,
self._mock_test_method_name
)
for flaky_attr in FlakyNames():
setattr(mock_test_method, flaky_attr, None)
@flaky(max_runs, min_passes)
def test_something():
pass