6363except ImportError :
6464 raise unittest .SkipTest ('GCP dependencies are not installed' )
6565
66- try :
67- import dill
68- except ImportError :
69- dill = None
70-
7166_LOGGER = logging .getLogger (__name__ )
7267
7368_DESTINATION_ELEMENT_PAIRS = [
@@ -411,13 +406,6 @@ def test_partition_files_dofn_size_split(self):
411406 label = 'CheckSinglePartition' )
412407
413408
414- def maybe_skip (compat_version ):
415- if compat_version and not dill :
416- raise unittest .SkipTest (
417- 'Dill dependency not installed which is required for compat_version'
418- ' <= 2.67.0' )
419-
420-
421409class TestBigQueryFileLoads (_TestCaseWithTempDirCleanUp ):
422410 def test_trigger_load_jobs_with_empty_files (self ):
423411 destination = "project:dataset.table"
@@ -497,9 +485,9 @@ def test_records_traverse_transform_with_mocks(self):
497485 param (compat_version = None ),
498486 param (compat_version = "2.64.0" ),
499487 ])
500- @pytest .mark .uses_dill
501488 def test_reshuffle_before_load (self , compat_version ):
502- maybe_skip (compat_version )
489+ from apache_beam .coders import typecoders
490+ typecoders .registry .force_dill_deterministic_coders = True
503491 destination = 'project1:dataset1.table1'
504492
505493 job_reference = bigquery_api .JobReference ()
@@ -525,13 +513,17 @@ def test_reshuffle_before_load(self, compat_version):
525513 validate = False ,
526514 temp_file_format = bigquery_tools .FileFormat .JSON )
527515
528- options = PipelineOptions (update_compatibility_version = compat_version )
516+ options = PipelineOptions (
517+ update_compatibility_version = compat_version ,
518+ # Disable unrelated compatibility change.
519+ force_cloudpickle_deterministic_coders = True )
529520 # Need to test this with the DirectRunner to avoid serializing mocks
530521 with TestPipeline ('DirectRunner' , options = options ) as p :
531522 _ = p | beam .Create (_ELEMENTS ) | transform
532523
533524 reshuffle_before_load = compat_version is None
534525 assert transform .reshuffle_before_load == reshuffle_before_load
526+ typecoders .registry .force_dill_deterministic_coders = False
535527
536528 def test_load_job_id_used (self ):
537529 job_reference = bigquery_api .JobReference ()
@@ -1008,7 +1000,9 @@ def dynamic_destination_resolver(element, *side_inputs):
10081000 ])
10091001 def test_triggering_frequency (
10101002 self , is_streaming , with_auto_sharding , compat_version ):
1011- maybe_skip (compat_version )
1003+ from apache_beam .coders import typecoders
1004+ typecoders .registry .force_dill_deterministic_coders = True
1005+
10121006 destination = 'project1:dataset1.table1'
10131007
10141008 job_reference = bigquery_api .JobReference ()
@@ -1114,6 +1108,8 @@ def __call__(self):
11141108 label = 'CheckDestinations' )
11151109 assert_that (jobs , equal_to (expected_jobs ), label = 'CheckJobs' )
11161110
1111+ typecoders .registry .force_dill_deterministic_coders = False
1112+
11171113
11181114class BigQueryFileLoadsIT (unittest .TestCase ):
11191115
0 commit comments