From a538c4a6b93ab255e0131e06804513f95fde00d6 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Mon, 24 Aug 2009 12:19:43 -0700 Subject: [PATCH] Slight improvement to hide twisted tests from people who don't have it. --- tests/__init__.py | 5 ++++- tests/test__twistedutil_protocol.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 34f9453..8c12d29 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -60,7 +60,10 @@ def requires_twisted(func): """ Decorator that skips a test if Twisted is not present.""" def requirement(_f): from eventlet.api import get_hub - return 'Twisted' in type(get_hub()).__name__ + try: + return 'Twisted' in type(get_hub()).__name__ + except Exception: + return False return skip_unless_requirement(requirement)(func) diff --git a/tests/test__twistedutil_protocol.py b/tests/test__twistedutil_protocol.py index 238d941..582731c 100644 --- a/tests/test__twistedutil_protocol.py +++ b/tests/test__twistedutil_protocol.py @@ -92,7 +92,8 @@ class TestCase(unittest.TestCase): @property def connector(self): return pr.GreenClientCreator(reactor, self.gtransportClass, self.transportBufferSize) - + + @requires_twisted def setUp(self): port = self.setup_server() self.conn = self.connector.connectTCP('127.0.0.1', port)