Thrift-2922: TRIAL is used with Python tests but not tested accordingly

Client: py
Patch: jfarrell

Updated configure.ac to require trial for py.twisted tests
This commit is contained in:
jfarrell 2015-06-23 21:58:50 -04:00
parent 417b631c5a
commit 6cdbd98b71
3 changed files with 11 additions and 9 deletions

View File

@ -260,15 +260,14 @@ AM_CONDITIONAL(WITH_LUA, [test "$have_lua" = "yes"])
AX_THRIFT_LIB(python, [Python], yes)
if test "$with_python" = "yes"; then
AC_PATH_PROG([TRIAL], [trial])
AM_PATH_PYTHON(2.4,, :)
if test "x$PYTHON" != "x" && test "x$PYTHON" != "x:" ; then
if test -n "$TRIAL" && test "x$PYTHON" != "x" && test "x$PYTHON" != "x:" ; then
have_python="yes"
fi
fi
AM_CONDITIONAL(WITH_PYTHON, [test "$have_python" = "yes"])
AC_PATH_PROG([TRIAL], [trial])
AX_THRIFT_LIB(perl, [Perl], yes)
if test "$with_perl" = "yes"; then
AC_PATH_PROG([PERL], [perl])

View File

@ -24,7 +24,7 @@ stubs: ../ThriftTest.thrift ../SmallTest.thrift
$(THRIFT) --gen py:twisted ../SmallTest.thrift
check: stubs
$(TRIAL) test_suite.py
$(TRIAL) ./test_suite.py
clean-local:
$(RM) -r gen-py.twisted

13
test/py.twisted/test_suite.py Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@ -17,9 +19,10 @@
# under the License.
#
import sys, glob, time
sys.path.insert(0, './gen-py.twisted')
sys.path.insert(0, glob.glob('../../lib/py/build/lib.*')[0])
import sys, os, glob, 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 ThriftTest import ThriftTest
from ThriftTest.ttypes import Xception, Xtruct
@ -147,8 +150,8 @@ class ThriftTestCase(unittest.TestCase):
def testDouble(self):
self.assertEquals((yield self.client.testDouble(-5.235098235)), -5.235098235)
# TODO: def testBinary(self) ...
# TODO: def testBinary(self) ...
@defer.inlineCallbacks
def testStruct(self):
x = Xtruct()