summaryrefslogtreecommitdiffhomepage
path: root/tests/stub_sftp.py
diff options
context:
space:
mode:
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)