diff options
author | Nobuaki Sukegawa <nsuke@apache.org> | 2016-02-10 19:42:19 +0900 |
---|---|---|
committer | James E. King, III <jking@apache.org> | 2017-11-30 12:36:11 -0500 |
commit | 6f8264037c138b5042cbdbe8a444c2cff6065ee6 (patch) | |
tree | 12e2ff4ca7a82b58bc27e1ec3ea0d20458f8887c /test/py.twisted | |
parent | 1ce7a5b459c47d6c960850a8a97eacc53a851452 (diff) | |
download | thrift-6f8264037c138b5042cbdbe8a444c2cff6065ee6.tar.gz |
THRIFT-3600 Make TTwisted server send exception on unexpected handler error
Client: py
This closes #838
This closes #1424
Diffstat (limited to 'test/py.twisted')
-rwxr-xr-x | test/py.twisted/test_suite.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/test/py.twisted/test_suite.py b/test/py.twisted/test_suite.py index 886de44d2..02eb7f14f 100755 --- a/test/py.twisted/test_suite.py +++ b/test/py.twisted/test_suite.py @@ -19,14 +19,17 @@ # under the License. # -import sys -import os import glob +import os +import sys import time + basepath = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(basepath, 'gen-py.twisted')) sys.path.insert(0, glob.glob(os.path.join(basepath, '../../lib/py/build/lib.*'))[0]) +from thrift.Thrift import TApplicationException + from ThriftTest import ThriftTest from ThriftTest.ttypes import Xception, Xtruct from thrift.transport import TTwisted @@ -84,6 +87,7 @@ class TestHandler: def fireOneway(t): self.onewaysQueue.put((t, time.time(), seconds)) reactor.callLater(seconds, fireOneway, time.time()) + raise Exception('') def testNest(self, thing): return thing @@ -171,7 +175,6 @@ class ThriftTestCase(unittest.TestCase): @defer.inlineCallbacks def testException(self): - yield self.client.testException('Safe') try: yield self.client.testException('Xception') self.fail("should have gotten exception") @@ -181,12 +184,15 @@ class ThriftTestCase(unittest.TestCase): try: yield self.client.testException("throw_undeclared") - self.fail("should have thrown exception") - except Exception: # type is undefined + self.fail("should have gotten exception") + except TApplicationException: pass + yield self.client.testException('Safe') + @defer.inlineCallbacks def testOneway(self): yield self.client.testOneway(1) start, end, seconds = yield self.handler.onewaysQueue.get() self.assertAlmostEquals(seconds, (end - start), places=1) + self.assertEquals((yield self.client.testI32(-1)), -1) |