This is an automated email from the ASF dual-hosted git repository.
shunping pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new c9669152cb3 fix flaky python tests (#40228)
c9669152cb3 is described below
commit c9669152cb3fe2ac29e5e3eb9a2d9977008d8cbd
Author: Derrick Williams <[email protected]>
AuthorDate: Fri Sep 25 10:37:42 2026 -0400
fix flaky python tests (#40228)
* fix flakey python tests
* make consistent changes for the tests
* remove cloudpickle changes for later
---
.../python/apache_beam/yaml/yaml_transform_test.py | 37 ++++++++++------------
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/sdks/python/apache_beam/yaml/yaml_transform_test.py
b/sdks/python/apache_beam/yaml/yaml_transform_test.py
index 4cfe625fc9c..5a1e7b9e220 100644
--- a/sdks/python/apache_beam/yaml/yaml_transform_test.py
+++ b/sdks/python/apache_beam/yaml/yaml_transform_test.py
@@ -295,11 +295,10 @@ class YamlTransformE2ETest(unittest.TestCase):
pd.testing.assert_frame_equal(data, result)
def test_circular_reference_validation(self):
- with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
- pickle_library='cloudpickle')) as p:
- # pylint: disable=expression-not-assigned
- with self.assertRaisesRegex(ValueError, r'Circular reference
detected.*'):
- p | YamlTransform(
+ with self.assertRaisesRegex(ValueError, r'Circular reference detected.*'):
+ with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
+ pickle_library='cloudpickle')) as p:
+ _ = p | YamlTransform(
'''
type: composite
transforms:
@@ -318,11 +317,10 @@ class YamlTransformE2ETest(unittest.TestCase):
providers=TEST_PROVIDERS)
def test_circular_reference_multi_inputs_validation(self):
- with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
- pickle_library='cloudpickle')) as p:
- # pylint: disable=expression-not-assigned
- with self.assertRaisesRegex(ValueError, r'Circular reference
detected.*'):
- p | YamlTransform(
+ with self.assertRaisesRegex(ValueError, r'Circular reference detected.*'):
+ with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
+ pickle_library='cloudpickle')) as p:
+ _ = p | YamlTransform(
'''
type: composite
transforms:
@@ -362,11 +360,10 @@ class YamlTransformE2ETest(unittest.TestCase):
assert_that(result, equal_to([0, 1, 9, 16]))
def test_name_is_ambiguous(self):
- with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
- pickle_library='cloudpickle')) as p:
- # pylint: disable=expression-not-assigned
- with self.assertRaisesRegex(ValueError, r'Circular reference
detected.*'):
- p | YamlTransform(
+ with self.assertRaisesRegex(ValueError, r'Circular reference detected.*'):
+ with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
+ pickle_library='cloudpickle')) as p:
+ _ = p | YamlTransform(
'''
type: composite
transforms:
@@ -389,11 +386,11 @@ class YamlTransformE2ETest(unittest.TestCase):
providers=TEST_PROVIDERS)
def test_empty_inputs_throws_error(self):
- with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
- pickle_library='cloudpickle')) as p:
- with self.assertRaisesRegex(ValueError,
- 'Missing inputs for transform at '
- '"EmptyInputOkButYamlDoesntKnow" at line
.*'):
+ with self.assertRaisesRegex(ValueError,
+ 'Missing inputs for transform at '
+ '"EmptyInputOkButYamlDoesntKnow" at line .*'):
+ with beam.Pipeline(options=beam.options.pipeline_options.PipelineOptions(
+ pickle_library='cloudpickle')) as p:
_ = p | YamlTransform(
'''
type: composite