diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2012-10-15 12:57:39 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2012-10-15 12:57:39 -0700 |
commit | 7c12862b55224faea75758ceef78135fa9119df2 (patch) | |
tree | 5f31c1326d2f8f615d9a8e3bb7c7ff36736b0fc4 | |
parent | 1341e28882998a08fa2bf00c21047207dff3e18a (diff) |
Only override unittest assertions when absolutely necessary.
Fixes #85
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | tests/test_transport.py | 6 |
2 files changed, 9 insertions, 2 deletions
@@ -18,6 +18,11 @@ 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) diff --git a/tests/test_transport.py b/tests/test_transport.py index cea4a1dd..67926d16 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -107,8 +107,10 @@ class NullServer (ServerInterface): class TransportTest (unittest.TestCase): - assertTrue = unittest.TestCase.failUnless # for Python 2.3 and below - assertFalse = unittest.TestCase.failIf # for Python 2.3 and below + if not hasattr(unittest.TestCase, 'assertTrue'): + assertTrue = unittest.TestCase.failUnless # for Python 2.3 and below + if not hasattr(unittest.TestCase, 'assertFalse'): + assertFalse = unittest.TestCase.failIf # for Python 2.3 and below def setUp(self): self.socks = LoopSocket() |