Origin: commit, revision id: jelmer@samba.org-20140717001539-0586k2u1i68hp22j
Author: Jelmer Vernooij <jelmer@samba.org>
Last-Update: 2014-07-17
Applied-Upstream: no
Status: submitted upstream
X-Bzr-Revision-Id: jelmer@samba.org-20140717001539-0586k2u1i68hp22j


=== modified file 'tests/test_upload.py'
--- old/tests/test_upload.py	2012-03-15 20:53:45 +0000
+++ new/tests/test_upload.py	2014-07-17 00:15:39 +0000
@@ -33,11 +33,17 @@
     features,
     per_branch,
     per_transport,
-    stub_sftp,
     )
+try:
+    import paramiko
+except ImportError:
+    stub_sftp = None
+    sftp = None
+else:
+    from bzrlib.tests import stub_sftp
+    from bzrlib.transport import sftp
 from bzrlib.transport import (
     ftp,
-    sftp,
     )
 from bzrlib.plugins.upload import (
     cmds,
@@ -50,7 +56,8 @@
     # Keep only the interesting ones for upload
     for name, d in basis:
         t_class = d['transport_class']
-        if t_class in (ftp.FtpTransport, sftp.SFTPTransport):
+        if (t_class == ftp.FtpTransport or
+            (sftp is not None and t_class == sftp.SFTPTransport)):
             result.append((name, d))
     try:
         import bzrlib.plugins.local_test_server
@@ -788,7 +795,7 @@
         self.add_file('hello', 'foo')
 
         remote_branch_url = self.get_url(self.remote_branch_dir)
-        if self.transport_server is stub_sftp.SFTPHomeDirServer:
+        if stub_sftp is not None and self.transport_server is stub_sftp.SFTPHomeDirServer:
             # FIXME: Some policy search ends up above the user home directory
             # and are seen as attemps to escape test isolation
             raise tests.TestNotApplicable('Escaping test isolation')

