-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
Description
Today I ran the integration tests for GAPIC microgenerator (for Python client) and our HEAD (master branch). I found it generates several errors. We may not want to pre-release a version that breaks them. I will work on the fix ASAP. This is a release blocker, CC @jtattermusch .
Here are the failures:
===================================================================================== FAILURES ======================================================================================
_____________________________________________________________________________________ test_lro ______________________________________________________________________________________
echo = <google.showcase_v1beta1.services.echo.client.EchoClient object at 0x7fc2e5179978>
def test_lro(echo):
future = echo.wait({
'end_time': datetime.now(tz=timezone.utc) + timedelta(seconds=1),
'success': {
> 'content': 'The hail in Wales falls mainly on the snails...eventually.'
}}
)
tests/system/test_grpc_lro.py:25:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
env/lib/python3.7/site-packages/google/showcase_v1beta1/services/echo/client.py:550: in wait
request = gs_echo.WaitRequest(request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[KeyError('_pb') raised in repr()] WaitRequest object at 0x7fc2e5179e80>
mapping = {'end_time': datetime.datetime(2020, 7, 20, 19, 45, 20, 43362, tzinfo=datetime.timezone.utc), 'success': content: "The hail in Wales falls mainly on the snails...eventually."
}
kwargs = {}, marshal = <proto.marshal.marshal.Marshal object at 0x7fc2e4f40ac8>, key = 'success', value = {'content': 'The hail in Wales falls mainly on the snails...eventually.'}
pb_type = <class 'WaitResponse'>, pb_value = content: "The hail in Wales falls mainly on the snails...eventually."
def __init__(self, mapping=None, **kwargs):
# We accept several things for `mapping`:
# * An instance of this class.
# * An instance of the underlying protobuf descriptor class.
# * A dict
# * Nothing (keyword arguments only).
#
# Sanity check: Did we get something not on that list? Error if so.
if mapping and not isinstance(
mapping, (collections.abc.Mapping, type(self), self._meta.pb)
):
raise TypeError(
"Invalid constructor input for %s: %r"
% (self.__class__.__name__, mapping,)
)
# Handle the first two cases: they both involve keeping
# a copy of the underlying protobuf descriptor instance.
if isinstance(mapping, type(self)):
mapping = mapping._pb
if isinstance(mapping, self._meta.pb):
# Make a copy of the mapping.
# This is a constructor for a new object, so users will assume
# that it will not have side effects on the arguments being
# passed in.
#
# The `__wrap_original` argument is private API to override
# this behavior, because `MessageRule` actually does want to
# wrap the original argument it was given. The `wrap` method
# on the metaclass is the public API for this behavior.
if not kwargs.pop("__wrap_original", False):
mapping = copy.copy(mapping)
self._pb = mapping
if kwargs:
self._pb.MergeFrom(self._meta.pb(**kwargs))
return
# Handle the remaining case by converging the mapping and kwargs
# dictionaries (with kwargs winning), and saving a descriptor
# based on that.
if mapping is None:
mapping = {}
mapping.update(kwargs)
# Update the mapping to address any values that need to be
# coerced.
marshal = self._meta.marshal
for key, value in copy.copy(mapping).items():
pb_type = self._meta.fields[key].pb_type
pb_value = marshal.to_proto(pb_type, value)
if pb_value is None:
mapping.pop(key)
else:
mapping[key] = pb_value
# Create the internal protocol buffer.
> self._pb = self._meta.pb(**mapping)
E TypeError: Parameter to MergeFrom() must be instance of same class: expected google.protobuf.Timestamp got datetime.datetime.
env/lib/python3.7/site-packages/proto/message.py:413: TypeError
__________________________________________________________________________________ test_lro_async ___________________________________________________________________________________
async_echo = <google.showcase_v1beta1.services.echo.async_client.EchoAsyncClient object at 0x7fc2e52754e0>
@pytest.mark.asyncio
async def test_lro_async(async_echo):
future = await async_echo.wait({
'end_time': datetime.now(tz=timezone.utc) + timedelta(seconds=1),
'success': {
> 'content': 'The hail in Wales falls mainly on the snails...eventually.'
}}
)
tests/system/test_grpc_lro.py:38:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
env/lib/python3.7/site-packages/google/showcase_v1beta1/services/echo/async_client.py:429: in wait
request = gs_echo.WaitRequest(request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[KeyError('_pb') raised in repr()] WaitRequest object at 0x7fc2e52756d8>
mapping = {'end_time': datetime.datetime(2020, 7, 20, 19, 45, 20, 140746, tzinfo=datetime.timezone.utc), 'success': content: "The hail in Wales falls mainly on the snails...eventually."
}
kwargs = {}, marshal = <proto.marshal.marshal.Marshal object at 0x7fc2e4f40ac8>, key = 'success', value = {'content': 'The hail in Wales falls mainly on the snails...eventually.'}
pb_type = <class 'WaitResponse'>, pb_value = content: "The hail in Wales falls mainly on the snails...eventually."
def __init__(self, mapping=None, **kwargs):
# We accept several things for `mapping`:
# * An instance of this class.
# * An instance of the underlying protobuf descriptor class.
# * A dict
# * Nothing (keyword arguments only).
#
# Sanity check: Did we get something not on that list? Error if so.
if mapping and not isinstance(
mapping, (collections.abc.Mapping, type(self), self._meta.pb)
):
raise TypeError(
"Invalid constructor input for %s: %r"
% (self.__class__.__name__, mapping,)
)
# Handle the first two cases: they both involve keeping
# a copy of the underlying protobuf descriptor instance.
if isinstance(mapping, type(self)):
mapping = mapping._pb
if isinstance(mapping, self._meta.pb):
# Make a copy of the mapping.
# This is a constructor for a new object, so users will assume
# that it will not have side effects on the arguments being
# passed in.
#
# The `__wrap_original` argument is private API to override
# this behavior, because `MessageRule` actually does want to
# wrap the original argument it was given. The `wrap` method
# on the metaclass is the public API for this behavior.
if not kwargs.pop("__wrap_original", False):
mapping = copy.copy(mapping)
self._pb = mapping
if kwargs:
self._pb.MergeFrom(self._meta.pb(**kwargs))
return
# Handle the remaining case by converging the mapping and kwargs
# dictionaries (with kwargs winning), and saving a descriptor
# based on that.
if mapping is None:
mapping = {}
mapping.update(kwargs)
# Update the mapping to address any values that need to be
# coerced.
marshal = self._meta.marshal
for key, value in copy.copy(mapping).items():
pb_type = self._meta.fields[key].pb_type
pb_value = marshal.to_proto(pb_type, value)
if pb_value is None:
mapping.pop(key)
else:
mapping[key] = pb_value
# Create the internal protocol buffer.
> self._pb = self._meta.pb(**mapping)
E TypeError: Parameter to MergeFrom() must be instance of same class: expected google.protobuf.Timestamp got datetime.datetime.
env/lib/python3.7/site-packages/proto/message.py:413: TypeError
__________________________________________________________________________ test_async_unary_stream_reader ___________________________________________________________________________
async_echo = <google.showcase_v1beta1.services.echo.async_client.EchoAsyncClient object at 0x7fc2e5196a20>
@pytest.mark.asyncio
async def test_async_unary_stream_reader(async_echo):
content = 'The hail in Wales falls mainly on the snails.'
call = await async_echo.expand({
'content': content,
}, metadata=metadata)
# Consume the response and ensure it matches what we expect.
# with pytest.raises(exceptions.NotFound) as exc:
for ground_truth in content.split(' '):
response = await call.read()
assert response.content == ground_truth
assert ground_truth == 'snails.'
trailing_metadata = await call.trailing_metadata()
> assert trailing_metadata == metadata
E AssertionError: assert Metadata((('s...llo world'),)) == (('showcase-t...ello world'),)
E Use -v to get the full diff
tests/system/test_grpc_streams.py:95: AssertionError
______________________________________________________________________ test_async_unary_stream_async_generator ______________________________________________________________________
async_echo = <google.showcase_v1beta1.services.echo.async_client.EchoAsyncClient object at 0x7fc2e52a07f0>
@pytest.mark.asyncio
async def test_async_unary_stream_async_generator(async_echo):
content = 'The hail in Wales falls mainly on the snails.'
call = await async_echo.expand({
'content': content,
}, metadata=metadata)
# Consume the response and ensure it matches what we expect.
# with pytest.raises(exceptions.NotFound) as exc:
tokens = iter(content.split(' '))
async for response in call:
ground_truth = next(tokens)
assert response.content == ground_truth
assert ground_truth == 'snails.'
trailing_metadata = await call.trailing_metadata()
> assert trailing_metadata == metadata
E AssertionError: assert Metadata((('s...llo world'),)) == (('showcase-t...ello world'),)
E Use -v to get the full diff
tests/system/test_grpc_streams.py:114: AssertionError
______________________________________________________________________ test_async_stream_stream_reader_writier ______________________________________________________________________
async_echo = <google.showcase_v1beta1.services.echo.async_client.EchoAsyncClient object at 0x7fc2e526dcf8>
@pytest.mark.asyncio
async def test_async_stream_stream_reader_writier(async_echo):
call = await async_echo.chat(metadata=metadata)
await call.write(showcase.EchoRequest(content="hello"))
await call.write(showcase.EchoRequest(content="world!"))
await call.done_writing()
contents = [
(await call.read()).content,
(await call.read()).content
]
assert contents == ['hello', 'world!']
trailing_metadata = await call.trailing_metadata()
> assert trailing_metadata == metadata
E AssertionError: assert Metadata((('s...llo world'),)) == (('showcase-t...ello world'),)
E Use -v to get the full diff
tests/system/test_grpc_streams.py:173: AssertionError
_____________________________________________________________________ test_async_stream_stream_async_generator ______________________________________________________________________
async_echo = <google.showcase_v1beta1.services.echo.async_client.EchoAsyncClient object at 0x7fc2e51c5390>
@pytest.mark.asyncio
async def test_async_stream_stream_async_generator(async_echo):
async def async_generator():
yield showcase.EchoRequest(content="hello")
yield showcase.EchoRequest(content="world!")
call = await async_echo.chat(async_generator(), metadata=metadata)
contents = []
async for response in call:
contents.append(response.content)
assert contents == ['hello', 'world!']
trailing_metadata = await call.trailing_metadata()
> assert trailing_metadata == metadata
E AssertionError: assert Metadata((('s...llo world'),)) == (('showcase-t...ello world'),)
E Use -v to get the full diff
tests/system/test_grpc_streams.py:191: AssertionError
_______________________________________________________________________ test_async_stream_stream_passing_dict _______________________________________________________________________
async_echo = <google.showcase_v1beta1.services.echo.async_client.EchoAsyncClient object at 0x7fc2e5196d30>
@pytest.mark.asyncio
async def test_async_stream_stream_passing_dict(async_echo):
requests = [{'content': 'hello'}, {'content': 'world!'}]
call = await async_echo.chat(iter(requests), metadata=metadata)
contents = []
async for response in call:
contents.append(response.content)
assert contents == ['hello', 'world!']
trailing_metadata = await call.trailing_metadata()
> assert trailing_metadata == metadata
E AssertionError: assert Metadata((('s...llo world'),)) == (('showcase-t...ello world'),)
E Use -v to get the full diff
tests/system/test_grpc_streams.py:205: AssertionError
______________________________________________________________________________ test_nonslash_resource _______________________________________________________________________________
messaging = <google.showcase_v1beta1.services.messaging.client.MessagingClient object at 0x7fc2e527ca20>
def test_nonslash_resource(messaging):
expected = "users/bdfl/profile/blurbs/legacy/apocalyptic~city"
> actual = messaging.blurb_path("bdfl", "apocalyptic", "city")
E TypeError: blurb_path() takes 2 positional arguments but 3 were given
tests/system/test_resource_crud.py:57: TypeError
_________________________________________________________________________________ test_path_parsing _________________________________________________________________________________
messaging = <google.showcase_v1beta1.services.messaging.client.MessagingClient object at 0x7fc2e52a86d8>
def test_path_parsing(messaging):
expected = {"room_id": "tiki"}
actual = messaging.parse_room_path(messaging.room_path("tiki"))
assert expected == actual
expected = {
"user_id": "bdfl",
"legacy_user_id": "apocalyptic",
"blurb_id": "city",
}
actual = messaging.parse_blurb_path(
> messaging.blurb_path("bdfl", "apocalyptic", "city")
)
E TypeError: blurb_path() takes 2 positional arguments but 3 were given
tests/system/test_resource_crud.py:74: TypeErrorReactions are currently unavailable