Skip to content

Commit bd80719

Browse files
committed
Windows support: path
1 parent 4017814 commit bd80719

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

exec_helpers/ssh_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def upload(self, source, target):
8787
self.mkdir(targetdir)
8888

8989
for entry in files:
90-
local_path = os.path.join(rootdir, entry)
90+
local_path = os.path.normpath(os.path.join(rootdir, entry))
9191
remote_path = posixpath.join(targetdir, entry)
9292
if self.exists(remote_path):
9393
self._sftp.unlink(remote_path)

test/test_ssh_client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import base64
2525
import contextlib
2626
import logging
27-
from os import path
27+
import os
2828
import posixpath
2929
import stat
3030
import unittest
@@ -1843,11 +1843,11 @@ def test_download(
18431843
self.assertTrue(result)
18441844
isdir.assert_called_once_with(target)
18451845
exists.assert_called_once_with(posixpath.join(
1846-
target, path.basename(dst)))
1846+
target, os.path.basename(dst)))
18471847
remote_isdir.assert_called_once_with(dst)
18481848
remote_exists.assert_called_once_with(dst)
18491849
_sftp.assert_has_calls((
1850-
mock.call.get(dst, posixpath.join(target, path.basename(dst))),
1850+
mock.call.get(dst, posixpath.join(target, os.path.basename(dst))),
18511851
))
18521852

18531853
# Negative scenarios
@@ -1917,7 +1917,7 @@ def test_upload_dir(
19171917
source = '/tmp/bash'
19181918
filename = 'bashrc'
19191919
walk.return_value = (source, '', [filename]),
1920-
expected_path = posixpath.join(target, path.basename(source))
1920+
expected_path = posixpath.join(target, os.path.basename(source))
19211921
expected_file = posixpath.join(expected_path, filename)
19221922

19231923
# noinspection PyTypeChecker
@@ -1928,5 +1928,8 @@ def test_upload_dir(
19281928
exists.assert_called_once_with(expected_file)
19291929
_sftp.assert_has_calls((
19301930
mock.call.unlink(expected_file),
1931-
mock.call.put(posixpath.join(source, filename), expected_file),
1931+
mock.call.put(
1932+
os.path.normpath(os.path.join(source, filename)),
1933+
expected_file
1934+
),
19321935
))

0 commit comments

Comments
 (0)