Abacn commented on PR #25007: URL: https://github.com/apache/beam/pull/25007#issuecomment-1382453506
ref: https://stackoverflow.com/questions/52428679/how-to-remove-classes-from-subclasses tested this approach should work. Code snippet: ```python from apache_beam.options.pipeline_options import PipelineOptions class PipelineOptionTest: class UserDefinedOptions(PipelineOptions): @classmethod def _add_argparse_args(cls, parser): parser.add_value_provider_argument('--gcs_location') @classmethod def setUpClass(cls): cls.UserDefinedOptions = PipelineOptionTest.UserDefinedOptions def tearDown(self): # Unset the option added in setupClass to avoid interfere with other tests del PipelineOptionTest.UserDefinedOptions import gc gc.collect() def run(self): print(PipelineOptions.__subclasses__()) x = PipelineOptions().get_all_options() print(x) if __name__ == '__main__': test_instance = PipelineOptionTest() test_instance.setUpClass() test_instance.run() test_instance.tearDown() test_instance.run() ``` output: >>> {'runner': None, ... 's3_region_name': None, 's3_api_version': None, 's3_verify': None, 's3_disable_ssl': False, 'gcs_location': <apache_beam.options.value_provider.RuntimeValueProvider object at 0x1288d3c70>} {'runner': None, ... 's3_region_name': None, 's3_api_version': None, 's3_verify': None, 's3_disable_ssl': False} >>> as can be seen the second run there is no longer `--gcs_location` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
