Skip to content

Commit 05aec5b

Browse files
author
Dan
committed
Updated tests to correctly test with multiple directories when copying files. Resolves #64. Bumped version
1 parent 5d202ca commit 05aec5b

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

pssh/pssh_client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ def __init__(self, hosts,
8888
:param proxy_port: (Optional) SSH port to use to login to proxy host if \
8989
set. Defaults to 22.
9090
:type proxy_port: int
91+
:param proxy_user: (Optional) User to login to ``proxy_host`` as. Defaults to \
92+
logged in user.
93+
:type proxy_user: str
94+
:param proxy_password: (Optional) Password to login to ``proxy_host`` with. \
95+
Defaults to no password
96+
:type proxy_password: str
97+
:param proxy_pkey: (Optional) Private key to be used for authentication \
98+
with ``proxy_host``. Defaults to available keys from SSHAgent and user's \
99+
home directory keys
100+
:type proxy_pkey: :mod:`paramiko.PKey`
91101
:param agent: (Optional) SSH agent object to programmatically supply an \
92102
agent to override system SSH agent with
93103
:type agent: :mod:`pssh.agent.SSHAgent`

pssh/ssh_client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,9 @@ def copy_file(self, local_file, remote_file, recurse=False):
348348
:param recurse: Whether or not to descend into directories recursively.
349349
:type recurse: bool
350350
351-
:raises: :mod:`ValueError` when a directory is supplied to local_file \
352-
and recurse is not set
351+
:raises: :mod:`ValueError` when a directory is supplied to ``local_file`` \
352+
and ``recurse`` is not set
353353
"""
354-
# import ipdb; ipdb.set_trace()
355354
if os.path.isdir(local_file) and recurse:
356355
return self._copy_dir(local_file, remote_file)
357356
elif os.path.isdir(local_file) and not recurse:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
convert_2_to_3['use_2to3'] = True
2222

2323
setup(name='parallel-ssh',
24-
version='0.92.1',
24+
version='0.92.2',
2525
description='Asynchronous parallel SSH library',
2626
author='Panos Kittenis',
2727
author_email='[email protected]',

tests/test_pssh_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def tearDown(self):
6262
del self.server
6363
del self.listen_socket
6464
del self.client
65-
65+
6666
def test_pssh_client_exec_command(self):
6767
cmd = self.client.exec_command(self.fake_cmd)[0]
6868
output = self.client.get_stdout(cmd)
@@ -360,7 +360,7 @@ def test_pssh_copy_file(self):
360360
del client
361361

362362
def test_pssh_client_directory(self):
363-
"""Tests copying directories with SSH client. Copy all the files from
363+
"""Tests copying multiple directories with SSH client. Copy all the files from
364364
local directory to server, then make sure they are all present."""
365365
test_file_data = 'test'
366366
local_test_path = 'directory_test'
@@ -373,8 +373,10 @@ def test_pssh_client_directory(self):
373373
os.mkdir(local_test_path)
374374
remote_file_paths = []
375375
for i in range(0, 10):
376-
local_file_path = os.path.join(local_test_path, 'foo' + str(i))
377-
remote_file_path = os.path.join(remote_test_path, 'foo' + str(i))
376+
local_file_path_dir = os.path.join(local_test_path, 'dir_foo' + str(i))
377+
os.mkdir(local_file_path_dir)
378+
local_file_path = os.path.join(local_file_path_dir, 'foo' + str(i))
379+
remote_file_path = os.path.join(remote_test_path, 'dir_foo' + str(i), 'foo' + str(i))
378380
remote_file_paths.append(remote_file_path)
379381
test_file = open(local_file_path, 'w')
380382
test_file.write(test_file_data)

0 commit comments

Comments
 (0)