Merge branch '1.8'
This commit is contained in:
commit
786920a320
9
NEWS
9
NEWS
|
@ -19,6 +19,15 @@ v1.9.0 (DD MM YYYY)
|
||||||
v1.8.1 (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)
|
v1.8.0 (3rd Oct 2012)
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
@ -612,12 +612,12 @@ class SFTPClient (BaseSFTP):
|
||||||
size = 0
|
size = 0
|
||||||
while True:
|
while True:
|
||||||
data = fr.read(32768)
|
data = fr.read(32768)
|
||||||
if len(data) == 0:
|
|
||||||
break
|
|
||||||
fl.write(data)
|
fl.write(data)
|
||||||
size += len(data)
|
size += len(data)
|
||||||
if callback is not None:
|
if callback is not None:
|
||||||
callback(size, file_size)
|
callback(size, file_size)
|
||||||
|
if len(data) == 0:
|
||||||
|
break
|
||||||
finally:
|
finally:
|
||||||
fl.close()
|
fl.close()
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -26,6 +26,8 @@ import unittest
|
||||||
from paramiko.buffered_pipe import BufferedPipe, PipeTimeout
|
from paramiko.buffered_pipe import BufferedPipe, PipeTimeout
|
||||||
from paramiko import pipe
|
from paramiko import pipe
|
||||||
|
|
||||||
|
from util import ParamikoTest
|
||||||
|
|
||||||
|
|
||||||
def delay_thread(pipe):
|
def delay_thread(pipe):
|
||||||
pipe.feed('a')
|
pipe.feed('a')
|
||||||
|
@ -39,11 +41,7 @@ def close_thread(pipe):
|
||||||
pipe.close()
|
pipe.close()
|
||||||
|
|
||||||
|
|
||||||
class BufferedPipeTest (unittest.TestCase):
|
class BufferedPipeTest(ParamikoTest):
|
||||||
|
|
||||||
assertTrue = unittest.TestCase.failUnless # for Python 2.3 and below
|
|
||||||
assertFalse = unittest.TestCase.failIf # for Python 2.3 and below
|
|
||||||
|
|
||||||
def test_1_buffered_pipe(self):
|
def test_1_buffered_pipe(self):
|
||||||
p = BufferedPipe()
|
p = BufferedPipe()
|
||||||
self.assert_(not p.read_ready())
|
self.assert_(not p.read_ready())
|
||||||
|
|
|
@ -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.common import MSG_KEXINIT, MSG_CHANNEL_WINDOW_ADJUST
|
||||||
from paramiko.message import Message
|
from paramiko.message import Message
|
||||||
from loop import LoopSocket
|
from loop import LoopSocket
|
||||||
|
from util import ParamikoTest
|
||||||
|
|
||||||
|
|
||||||
LONG_BANNER = """\
|
LONG_BANNER = """\
|
||||||
|
@ -105,11 +106,7 @@ class NullServer (ServerInterface):
|
||||||
return OPEN_SUCCEEDED
|
return OPEN_SUCCEEDED
|
||||||
|
|
||||||
|
|
||||||
class TransportTest (unittest.TestCase):
|
class TransportTest(ParamikoTest):
|
||||||
|
|
||||||
assertTrue = unittest.TestCase.failUnless # for Python 2.3 and below
|
|
||||||
assertFalse = unittest.TestCase.failIf # for Python 2.3 and below
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.socks = LoopSocket()
|
self.socks = LoopSocket()
|
||||||
self.sockc = LoopSocket()
|
self.sockc = LoopSocket()
|
||||||
|
|
|
@ -28,6 +28,7 @@ import unittest
|
||||||
from Crypto.Hash import SHA
|
from Crypto.Hash import SHA
|
||||||
import paramiko.util
|
import paramiko.util
|
||||||
|
|
||||||
|
from util import ParamikoTest
|
||||||
|
|
||||||
test_config_file = """\
|
test_config_file = """\
|
||||||
Host *
|
Host *
|
||||||
|
@ -58,17 +59,7 @@ BGQ3GQ/Fc7SX6gkpXkwcZryoi4kNFhHu5LvHcZPdxXV1D+uTMfGS1eyd2Yz/DoNWXNAl8TI0cAsW\
|
||||||
from paramiko import *
|
from paramiko import *
|
||||||
|
|
||||||
|
|
||||||
class UtilTest (unittest.TestCase):
|
class UtilTest(ParamikoTest):
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
def test_1_import(self):
|
def test_1_import(self):
|
||||||
"""
|
"""
|
||||||
verify that all the classes can be imported from paramiko.
|
verify that all the classes can be imported from paramiko.
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue