From 8e14be348cef73bba2ce35c8f6bcb238fc25fd36 Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Fri, 13 Jan 2023 16:36:52 -0500 Subject: [PATCH] Fix PipelineOptionTest.test_display_data --- sdks/python/apache_beam/examples/snippets/snippets.py | 2 +- sdks/python/apache_beam/io/gcp/bigquery_test.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sdks/python/apache_beam/examples/snippets/snippets.py b/sdks/python/apache_beam/examples/snippets/snippets.py index c3d94fb3a68d..aabbb95db3a4 100644 --- a/sdks/python/apache_beam/examples/snippets/snippets.py +++ b/sdks/python/apache_beam/examples/snippets/snippets.py @@ -1442,7 +1442,7 @@ def accessing_valueprovider_info_after_run(): import apache_beam as beam from apache_beam.options.pipeline_options import PipelineOptions - from apache_beam.utils.value_provider import RuntimeValueProvider + from apache_beam.options.value_provider import RuntimeValueProvider class MyOptions(PipelineOptions): @classmethod diff --git a/sdks/python/apache_beam/io/gcp/bigquery_test.py b/sdks/python/apache_beam/io/gcp/bigquery_test.py index 02e6fb04c47a..18048e94054a 100644 --- a/sdks/python/apache_beam/io/gcp/bigquery_test.py +++ b/sdks/python/apache_beam/io/gcp/bigquery_test.py @@ -20,6 +20,7 @@ import datetime import decimal +import gc import json import logging import os @@ -303,6 +304,13 @@ def tearDown(self): # Reset runtime options to avoid side-effects caused by other tests. RuntimeValueProvider.set_runtime_options(None) + @classmethod + def tearDownClass(cls): + # Unset the option added in setupClass to avoid interfere with other tests. + # Force a gc so PipelineOptions.__subclass__() no longer contains it. + del cls.UserDefinedOptions + gc.collect() + def test_get_destination_uri_empty_runtime_vp(self): with self.assertRaisesRegex(ValueError, '^ReadFromBigQuery requires a GCS '