gemini-code-assist[bot] commented on code in PR #37509:
URL: https://github.com/apache/beam/pull/37509#discussion_r2766804455


##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads_test.py:
##########
@@ -513,17 +511,14 @@ def test_reshuffle_before_load(self, compat_version):
         validate=False,
         temp_file_format=bigquery_tools.FileFormat.JSON)
 
-    options = PipelineOptions(
-        update_compatibility_version=compat_version,
-        # Disable unrelated compatibility change.
-        force_cloudpickle_deterministic_coders=True)
+    options = PipelineOptions(update_compatibility_version=compat_version)
+    object.__setattr__(options, 'force_dill_deterministic_coders', True)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `object.__setattr__` to set a test-only option can be a bit opaque. To 
make this cleaner and more explicit, consider adding 
`force_dill_deterministic_coders` as a formal option to `TestingOptions` in 
`sdks/python/apache_beam/options/pipeline_options.py`.
   
   You would add this to `TestingOptions._add_argparse_args`:
   ```python
   parser.add_argument(
       '--force_dill_deterministic_coders',
       default=False,
       action='store_true',
       help='(INTERNAL) For testing purposes. Force the use of dill-based '
       'deterministic coders for backward compatibility testing.')
   ```
   
   This would allow you to set the option directly in the `PipelineOptions` 
constructor as suggested, making the test setup more readable and maintainable. 
This change should be applied to other tests using this pattern as well.
   
   ```suggestion
       options = PipelineOptions(
           update_compatibility_version=compat_version,
           force_dill_deterministic_coders=True)
   ```



-- 
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]

Reply via email to