summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tests/test_buffered_pipe.py8
-rw-r--r--tests/test_transport.py9
-rw-r--r--tests/test_util.py13
-rw-r--r--tests/util.py10
4 files changed, 17 insertions, 23 deletions
diff --git a/tests/test_buffered_pipe.py b/tests/test_buffered_pipe.py
index f285d05b..b9d91f6a 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 67926d16..1c57d18d 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,13 +106,7 @@ class NullServer (ServerInterface):
return OPEN_SUCCEEDED
-class TransportTest (unittest.TestCase):
-
- 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
-
+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 7e56245d..458709b2 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 00000000..2e0be087
--- /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
+