[X2go-Commits] python-paramiko.git - master (branch) updated: 786920a3208fa335f334689d65b7302e9d52a568

X2Go dev team git-admin at x2go.org
Fri Nov 2 22:44:17 CET 2012


The branch, master has been updated
       via  786920a3208fa335f334689d65b7302e9d52a568 (commit)
       via  dfb45dec7fac59559009cac16d9b354ef4890de3 (commit)
       via  7c12862b55224faea75758ceef78135fa9119df2 (commit)
       via  1341e28882998a08fa2bf00c21047207dff3e18a (commit)
       via  78815afe9db56846279ceee5af3863c0ee16e9b8 (commit)
       via  8e5f774965bc281b8154379f68e6152356eedfd8 (commit)
       via  45969670db14401819958dd46fa72b904c3bd8cc (commit)
       via  e99399ce6683aa137cdc8199407fb8673a345cca (commit)
       via  e3ab0489f3ea6eef767818d3427ba6f08362f0ef (commit)
      from  09488c665ba46057648a13a12c76f0c6392a86a1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 NEWS                        |   21 +++++++++++++++++++--
 fabfile.py                  |   13 +++++++++++++
 paramiko/sftp_client.py     |    4 ++--
 tests/test_buffered_pipe.py |    8 +++-----
 tests/test_transport.py     |    7 ++-----
 tests/test_util.py          |   13 ++-----------
 tests/util.py               |   10 ++++++++++
 7 files changed, 51 insertions(+), 25 deletions(-)
 create mode 100644 fabfile.py
 create mode 100644 tests/util.py

The diff of changes is:
diff --git a/NEWS b/NEWS
index 37739c6..ed9fd00 100644
--- a/NEWS
+++ b/NEWS
@@ -12,8 +12,25 @@ Issues noted as "Fabric #NN" can be found at https://github.com/fabric/fabric/.
 Releases
 ========
 
-v1.8.0 <DATE>
----------------
+v1.9.0 (DD MM YYYY)
+-------------------
+
+
+v1.8.1 (DD MM YYYY)
+-------------------
+
+* #90: Ensure that callbacks handed to `SFTPClient.get()` always fire at least
+  once, even for zero-length files downloaded. Thanks to Github user `@enB` for
+  the catch.
+* #85: Paramiko's test suite overrides
+  `unittest.TestCase.assertTrue/assertFalse` to provide these modern assertions
+  to Python 2.2/2.3, which lacked them. However on newer Pythons such as 2.7,
+  this now causes deprecation warnings. The overrides have been patched to only
+  execute when necessary. Thanks to `@Arfrever` for catch & patch.
+
+
+v1.8.0 (3rd Oct 2012)
+---------------------
 
 * 'ssh' 32: Raise a more useful error explaining which `known_hosts` key line was
   problematic, when encountering `binascii` issues decoding known host keys.
diff --git a/fabfile.py b/fabfile.py
new file mode 100644
index 0000000..29394f9
--- /dev/null
+++ b/fabfile.py
@@ -0,0 +1,13 @@
+from fabric.api import task, sudo, env
+from fabric.contrib.project import rsync_project
+
+
+ at task
+def upload_docs():
+    target = "/var/www/paramiko.org"
+    staging = "/tmp/paramiko_docs"
+    sudo("mkdir -p %s" % staging)
+    sudo("chown -R %s %s" % (env.user, staging))
+    sudo("rm -rf %s/*" % target)
+    rsync_project(local_dir='docs/', remote_dir=staging, delete=True)
+    sudo("cp -R %s/* %s/" % (staging, target))
diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py
index f446ba3..3eaefc9 100644
--- a/paramiko/sftp_client.py
+++ b/paramiko/sftp_client.py
@@ -612,12 +612,12 @@ class SFTPClient (BaseSFTP):
                 size = 0
                 while True:
                     data = fr.read(32768)
-                    if len(data) == 0:
-                        break
                     fl.write(data)
                     size += len(data)
                     if callback is not None:
                         callback(size, file_size)
+                    if len(data) == 0:
+                        break
             finally:
                 fl.close()
         finally:
diff --git a/tests/test_buffered_pipe.py b/tests/test_buffered_pipe.py
index f285d05..b9d91f6 100644
--- a/tests/test_buffered_pipe.py
+++ b/tests/test_buffered_pipe.py
@@ -26,6 +26,8 @@ import unittest
 from paramiko.buffered_pipe import BufferedPipe, PipeTimeout
 from paramiko import pipe
 
+from util import ParamikoTest
+
 
 def delay_thread(pipe):
     pipe.feed('a')
@@ -39,11 +41,7 @@ def close_thread(pipe):
     pipe.close()
 
 
-class BufferedPipeTest (unittest.TestCase):
-
-    assertTrue = unittest.TestCase.failUnless   # for Python 2.3 and below
-    assertFalse = unittest.TestCase.failIf      # for Python 2.3 and below
-
+class BufferedPipeTest(ParamikoTest):
     def test_1_buffered_pipe(self):
         p = BufferedPipe()
         self.assert_(not p.read_ready())
diff --git a/tests/test_transport.py b/tests/test_transport.py
index cea4a1d..1c57d18 100644
--- a/tests/test_transport.py
+++ b/tests/test_transport.py
@@ -36,6 +36,7 @@ from paramiko import OPEN_SUCCEEDED, OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
 from paramiko.common import MSG_KEXINIT, MSG_CHANNEL_WINDOW_ADJUST
 from paramiko.message import Message
 from loop import LoopSocket
+from util import ParamikoTest
 
 
 LONG_BANNER = """\
@@ -105,11 +106,7 @@ class NullServer (ServerInterface):
         return OPEN_SUCCEEDED
 
 
-class TransportTest (unittest.TestCase):
-
-    assertTrue = unittest.TestCase.failUnless   # for Python 2.3 and below
-    assertFalse = unittest.TestCase.failIf      # for Python 2.3 and below
-
+class TransportTest(ParamikoTest):
     def setUp(self):
         self.socks = LoopSocket()
         self.sockc = LoopSocket()
diff --git a/tests/test_util.py b/tests/test_util.py
index 7e56245..458709b 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -28,6 +28,7 @@ import unittest
 from Crypto.Hash import SHA
 import paramiko.util
 
+from util import ParamikoTest
 
 test_config_file = """\
 Host *
@@ -58,17 +59,7 @@ BGQ3GQ/Fc7SX6gkpXkwcZryoi4kNFhHu5LvHcZPdxXV1D+uTMfGS1eyd2Yz/DoNWXNAl8TI0cAsW\
 from paramiko import *
 
 
-class UtilTest (unittest.TestCase):
-
-    assertTrue = unittest.TestCase.failUnless   # for Python 2.3 and below
-    assertFalse = unittest.TestCase.failIf      # for Python 2.3 and below
-
-    def setUp(self):
-        pass
-
-    def tearDown(self):
-        pass
-    
+class UtilTest(ParamikoTest):
     def test_1_import(self):
         """
         verify that all the classes can be imported from paramiko.
diff --git a/tests/util.py b/tests/util.py
new file mode 100644
index 0000000..2e0be08
--- /dev/null
+++ b/tests/util.py
@@ -0,0 +1,10 @@
+import unittest
+
+
+class ParamikoTest(unittest.TestCase):
+    # for Python 2.3 and below
+    if not hasattr(unittest.TestCase, 'assertTrue'):
+        assertTrue = unittest.TestCase.failUnless
+    if not hasattr(unittest.TestCase, 'assertFalse'):
+        assertFalse = unittest.TestCase.failIf
+


hooks/post-receive
-- 
python-paramiko.git (Debian package python-paramiko)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-paramiko.git" (Debian package python-paramiko).




More information about the x2go-commits mailing list