tests for moved ParseError logging; 17acf41
This commit is contained in:
parent
ce40191c60
commit
a049df6859
|
|
@ -331,21 +331,34 @@ class TestCase_IS_consumer(unittest.TestCase):
|
||||||
self.ais._socket_readlines(False).AndRaise(SystemExit)
|
self.ais._socket_readlines(False).AndRaise(SystemExit)
|
||||||
self.ais._socket_readlines(False).AndRaise(KeyboardInterrupt)
|
self.ais._socket_readlines(False).AndRaise(KeyboardInterrupt)
|
||||||
self.ais._socket_readlines(False).AndRaise(Exception("random"))
|
self.ais._socket_readlines(False).AndRaise(Exception("random"))
|
||||||
self.ais._socket_readlines(False).AndRaise(StopIteration)
|
self.ais._socket_readlines(False).AndRaise(aprslib.exceptions.ParseError('x'))
|
||||||
|
self.ais._socket_readlines(False).AndRaise(aprslib.exceptions.UnknownFormat('x'))
|
||||||
|
self.ais._socket_readlines(False).AndRaise(aprslib.exceptions.LoginError('x'))
|
||||||
self.ais._socket_readlines(False).AndRaise(aprslib.exceptions.GenericError('x'))
|
self.ais._socket_readlines(False).AndRaise(aprslib.exceptions.GenericError('x'))
|
||||||
|
self.ais._socket_readlines(False).AndRaise(StopIteration)
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
def testcallback(line):
|
def testcallback(line):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for e in [SystemExit, KeyboardInterrupt, Exception]:
|
# should raise
|
||||||
|
for e in [
|
||||||
|
SystemExit,
|
||||||
|
KeyboardInterrupt,
|
||||||
|
Exception
|
||||||
|
]:
|
||||||
with self.assertRaises(e):
|
with self.assertRaises(e):
|
||||||
self.ais.consumer(callback=testcallback, blocking=False, raw=False)
|
self.ais.consumer(callback=testcallback, blocking=False, raw=False)
|
||||||
|
|
||||||
# StopIteration
|
# non raising
|
||||||
self.ais.consumer(callback=testcallback, blocking=False, raw=False)
|
for e in [
|
||||||
# GenericError
|
aprslib.exceptions.ParseError,
|
||||||
self.ais.consumer(callback=testcallback, blocking=False, raw=False)
|
aprslib.exceptions.UnknownFormat,
|
||||||
|
aprslib.exceptions.LoginError,
|
||||||
|
aprslib.exceptions.GenericError,
|
||||||
|
StopIteration
|
||||||
|
]:
|
||||||
|
self.ais.consumer(callback=testcallback, blocking=False, raw=False)
|
||||||
|
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue