summaryrefslogtreecommitdiffhomepage
path: root/tests/stub_sftp.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2019-06-08 17:07:36 -0400
committerJeff Forcier <jeff@bitprophet.org>2019-06-08 17:09:17 -0400
commit5c0dc5b6ceb182115ad646ccca52707f5cfca4f0 (patch)
tree95501ba782a44f9564affdef064c18754b109809 /tests/stub_sftp.py
parentf4e618bafb1be025ce932ed580cdd529f4101d73 (diff)
parent03cf3215670bd4467d1296173c4c184a4be089ab (diff)
Merge branch '2.4'
Diffstat (limited to 'tests/stub_sftp.py')
-rw-r--r--tests/stub_sftp.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/stub_sftp.py b/tests/stub_sftp.py
index 100076d6..1528a0b8 100644
--- a/tests/stub_sftp.py
+++ b/tests/stub_sftp.py
@@ -21,18 +21,17 @@ A stub SFTP server for loopback SFTP testing.
"""
import os
-import sys
from paramiko import (
- ServerInterface,
- SFTPServerInterface,
- SFTPServer,
+ AUTH_SUCCESSFUL,
+ OPEN_SUCCEEDED,
SFTPAttributes,
SFTPHandle,
- SFTP_OK,
+ SFTPServer,
+ SFTPServerInterface,
SFTP_FAILURE,
- AUTH_SUCCESSFUL,
- OPEN_SUCCEEDED,
+ SFTP_OK,
+ ServerInterface,
)
from paramiko.common import o666
@@ -65,7 +64,8 @@ class StubSFTPHandle(SFTPHandle):
class StubSFTPServer(SFTPServerInterface):
# assume current folder is a fine root
- # (the tests always create and eventually delete a subfolder, so there shouldn't be any mess)
+ # (the tests always create and eventually delete a subfolder, so there
+ # shouldn't be any mess)
ROOT = os.getcwd()
def _realpath(self, path):
@@ -206,7 +206,8 @@ class StubSFTPServer(SFTPServerInterface):
# compute relative to path
abspath = os.path.join(os.path.dirname(path), target_path)
if abspath[: len(self.ROOT)] != self.ROOT:
- # this symlink isn't going to work anyway -- just break it immediately
+ # this symlink isn't going to work anyway -- just break it
+ # immediately
target_path = "<error>"
try:
os.symlink(target_path, path)