From ba01ab6599a7dd3088e31391701e441b4413367d Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Mon, 12 Oct 2015 14:55:56 -0700 Subject: [PATCH] Fix test for absent return values in thrift scheme thriftrw now raises TypeError if return value is absent for non-void methods. --- tests/schemes/test_thrift.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/schemes/test_thrift.py b/tests/schemes/test_thrift.py index 38466d09..89b87b34 100644 --- a/tests/schemes/test_thrift.py +++ b/tests/schemes/test_thrift.py @@ -1012,7 +1012,7 @@ def testMultiException(request): @pytest.mark.gen_test @pytest.mark.call def test_value_expected_but_none_returned_should_error( - server, service, ThriftTest, use_thriftrw_server + server, service, ThriftTest, use_thriftrw_server, use_thriftrw_client ): # Given this test server: @@ -1031,7 +1031,13 @@ def testString(request): # values. exc = UnexpectedError else: - exc = ValueExpectedError + # If server is using thrift, it will be able to return an invalid + # response. thriftrw will fail with a TypeError on invalid values. For + # thrift, we'll check manually and raise ValueExpectedError. + if use_thriftrw_client: + exc = TypeError + else: + exc = ValueExpectedError with pytest.raises(exc) as exc_info: yield tchannel.thrift( @@ -1039,8 +1045,11 @@ def testString(request): ) if not use_thriftrw_server: - assert 'Expected a value to be returned' in str(exc_info) - assert 'ThriftTest::testString' in str(exc_info) + if use_thriftrw_client: + assert 'did not receive any values' in str(exc_info) + else: + assert 'Expected a value to be returned' in str(exc_info) + assert 'ThriftTest::testString' in str(exc_info) @pytest.mark.gen_test