From be200e712b5514387ee578e886ec36ae640800e1 Mon Sep 17 00:00:00 2001 From: Gabi Davar Date: Wed, 24 Aug 2016 09:08:20 +0300 Subject: skip test on windows - no SIGALRM. --- tests/test_packetizer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/test_packetizer.py') diff --git a/tests/test_packetizer.py b/tests/test_packetizer.py index 8faec03c..5fa54e4a 100644 --- a/tests/test_packetizer.py +++ b/tests/test_packetizer.py @@ -20,6 +20,7 @@ Some unit tests for the ssh2 protocol in Transport. """ +import sys import unittest from hashlib import sha1 @@ -33,7 +34,6 @@ from paramiko.common import byte_chr, zero_byte x55 = byte_chr(0x55) x1f = byte_chr(0x1f) - class PacketizerTest (unittest.TestCase): def test_1_write(self): @@ -75,6 +75,7 @@ class PacketizerTest (unittest.TestCase): self.assertEqual(1, m.get_int()) self.assertEqual(900, m.get_int()) + @unittest.skipIf(sys.platform.startswith("win"), 'no SIGALRM on windows') def test_3_closed(self): rsock = LoopSocket() wsock = LoopSocket() -- cgit v1.2.3 From c6b209dd5690807d8e8e55518c409b164ac2e383 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 5 Dec 2016 20:56:24 -0800 Subject: Looks like skipIf was added in 2.7? Dies on 2.6 --- tests/test_packetizer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/test_packetizer.py') diff --git a/tests/test_packetizer.py b/tests/test_packetizer.py index 5fa54e4a..15a7c93f 100644 --- a/tests/test_packetizer.py +++ b/tests/test_packetizer.py @@ -75,8 +75,9 @@ class PacketizerTest (unittest.TestCase): self.assertEqual(1, m.get_int()) self.assertEqual(900, m.get_int()) - @unittest.skipIf(sys.platform.startswith("win"), 'no SIGALRM on windows') def test_3_closed(self): + if sys.platform.startswith("win"): # no SIGALRM on windows + return rsock = LoopSocket() wsock = LoopSocket() rsock.link(wsock) -- cgit v1.2.3 From 3c9537d506568272f0a8469f8336bd944c6841bf Mon Sep 17 00:00:00 2001 From: Sofian Brabez Date: Wed, 14 Dec 2016 20:57:55 +0100 Subject: Avoid PacketizerTest.test_closed_3 to fail on platforms where errno.ETIME is not defined This changes define the proper Timer expired error message instead of raising AttributeError when errno.ETIME is not available on the platform. fixes #862 --- tests/test_packetizer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests/test_packetizer.py') diff --git a/tests/test_packetizer.py b/tests/test_packetizer.py index a1ea398c..02173292 100644 --- a/tests/test_packetizer.py +++ b/tests/test_packetizer.py @@ -114,9 +114,13 @@ class PacketizerTest (unittest.TestCase): import signal class TimeoutError(Exception): - pass + def __init__(self, error_message): + if hasattr(errno, 'ETIME'): + self.message = os.sterror(errno.ETIME) + else: + self.messaage = error_message - def timeout(seconds=1, error_message=os.strerror(errno.ETIME)): + def timeout(seconds=1, error_message='Timer expired'): def decorator(func): def _handle_timeout(signum, frame): raise TimeoutError(error_message) -- cgit v1.2.3