Skip to content

Commit e11c104

Browse files
iindyktfx-copybara
authored andcommitted
Fixing test breakages caused by newer versions of our dependencies.
- example_proto_coder_test: default implementation uses 'python' proto mode. We were previously relying on the fact that some of our dependencies set the proto implementation mode to 'cpp' (by checking it against the default value of `proto_implementation_type` flag). This change explicitly sets the implementation mode to 'cpp' for the test. - impl_test: beam's error msg is slightly different in newer version (of apache-beam?) ("list" vs "<class 'list'>"), so I generalized it. PiperOrigin-RevId: 474419283
1 parent 1b2d9b6 commit e11c104

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

tensorflow_transform/beam/impl_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4316,9 +4316,9 @@ def testHandleBatchError(self):
43164316
def preprocessing_fn(inputs):
43174317
return {'x_scaled': tft.scale_to_0_1(inputs['x'])}
43184318

4319-
# Exception type depends on the running being used.
4319+
# Exception type depends on the runner being used.
43204320
with self.assertRaisesRegexp(
4321-
(RuntimeError, ValueError, TypeError), 'has type list'):
4321+
(RuntimeError, ValueError, TypeError), 'has type .*list'):
43224322
# TODO(b/149997088): Remove this explicit use of DirectRunner.
43234323
with beam.Pipeline() as pipeline:
43244324
metadata = tft.DatasetMetadata.from_feature_spec({

tensorflow_transform/coders/example_proto_coder_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
# pretty early on.
2525
if any(arg == '--proto_implementation_type=python' for arg in sys.argv):
2626
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'python'
27-
elif any(arg == '--proto_implementation_type=cpp' for arg in sys.argv):
27+
else:
2828
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
29-
elif any(arg.startswith('--proto_implementation_type') for arg in sys.argv):
30-
raise ValueError('Unexpected value for --proto_implementation_type')
29+
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION'] = '2'
3130

3231
# pylint: disable=g-import-not-at-top
3332
import numpy as np

0 commit comments

Comments
 (0)