Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Fix test for absent return values in thrift scheme
Browse files Browse the repository at this point in the history
thriftrw now raises TypeError if return value is absent for non-void methods.
  • Loading branch information
abhinav committed Oct 12, 2015
1 parent 1bf13c7 commit ba01ab6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/schemes/test_thrift.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -1031,16 +1031,25 @@ 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(
service.testString('no return!?')
)

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
Expand Down

0 comments on commit ba01ab6

Please sign in to comment.