Slight improvement to hide twisted tests from people who don't have it.
This commit is contained in:
@@ -60,7 +60,10 @@ def requires_twisted(func):
|
|||||||
""" Decorator that skips a test if Twisted is not present."""
|
""" Decorator that skips a test if Twisted is not present."""
|
||||||
def requirement(_f):
|
def requirement(_f):
|
||||||
from eventlet.api import get_hub
|
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)
|
return skip_unless_requirement(requirement)(func)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -92,7 +92,8 @@ class TestCase(unittest.TestCase):
|
|||||||
@property
|
@property
|
||||||
def connector(self):
|
def connector(self):
|
||||||
return pr.GreenClientCreator(reactor, self.gtransportClass, self.transportBufferSize)
|
return pr.GreenClientCreator(reactor, self.gtransportClass, self.transportBufferSize)
|
||||||
|
|
||||||
|
@requires_twisted
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
port = self.setup_server()
|
port = self.setup_server()
|
||||||
self.conn = self.connector.connectTCP('127.0.0.1', port)
|
self.conn = self.connector.connectTCP('127.0.0.1', port)
|
||||||
|
Reference in New Issue
Block a user