THRIFT-3600 Make TTwisted server send exception on unexpected handler error
Client: py
This closes #838
This closes #1424
diff --git a/test/py.twisted/test_suite.py b/test/py.twisted/test_suite.py
index 886de44..02eb7f1 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 @@
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 @@
@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 @@
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)