Skip to content

Commit

Permalink
Avoid PacketizerTest.test_closed_3 to fail on platforms where errno.E…
Browse files Browse the repository at this point in the history
…TIME

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
  • Loading branch information
sbz authored and bitprophet committed Feb 20, 2017
1 parent c0c6bd8 commit a4db55c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/test_packetizer.py
Expand Up @@ -101,9 +101,13 @@ def test_3_closed(self):
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)
Expand Down

0 comments on commit a4db55c

Please sign in to comment.