[
https://issues.apache.org/jira/browse/BEAM-14231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17516161#comment-17516161
]
Andrew Pilloud commented on BEAM-14231:
---------------------------------------
I added an exception in my code change, it doesn't get bubbled up into this
test.
This reproduces every few runs using
`:sdks:python:test-suites:tox:py39:testPy39`. (I don't have Python 3.8 so I've
also updated the default python version to 3.9 in BeamModulePlugin.groovy).
When the exception does happen it is coming from the conversion code in
typing_from_runner_api, when the exception doesn't happen the type is coming
from the schema registry. I added the following assert to the schema registry
to easily show the corruption:
{code}
--- a/sdks/python/apache_beam/typehints/schemas.py
+++ b/sdks/python/apache_beam/typehints/schemas.py
@@ -104,6 +104,8 @@ class SchemaTypeRegistry(object):
"schemas.")
def add(self, typing, schema):
+ if schema.id is None:
+ raise AssertionError("Attempted to cache schema without id")
self.by_id[schema.id] = (typing, schema)
def get_typing_by_id(self, unique_id):
{code}
> Python precommit failing test_schema_with_bad_field_raises_helpful_error
> ------------------------------------------------------------------------
>
> Key: BEAM-14231
> URL: https://issues.apache.org/jira/browse/BEAM-14231
> Project: Beam
> Issue Type: Test
> Components: test-failures
> Reporter: Kiley Sok
> Assignee: Andrew Pilloud
> Priority: P2
>
> apache_beam.typehints.schemas_test.SchemaTest.test_schema_with_bad_field_raises_helpful_error
> (from py39-cloud)
> self = <apache_beam.typehints.schemas_test.SchemaTest
> testMethod=test_schema_with_bad_field_raises_helpful_error>
> def test_schema_with_bad_field_raises_helpful_error(self):
> schema_proto = schema_pb2.Schema(
> fields=[
> schema_pb2.Field(
> name="type_with_no_typeinfo", type=schema_pb2.FieldType())
> ])
>
> # Should raise an exception referencing the problem field
> > self.assertRaisesRegex(
> ValueError,
> "type_with_no_typeinfo",
> lambda: named_tuple_from_schema(schema_proto))
> E AssertionError: ValueError not raised by <lambda>
> apache_beam/typehints/schemas_test.py:320: AssertionError
> https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/5455
--
This message was sent by Atlassian Jira
(v8.20.1#820001)