@@ -501,14 +501,34 @@ def consensus_project_with_batch(
501501
502502@pytest .fixture
503503def dataset (client , rand_gen ):
504- dataset = client .create_dataset (name = rand_gen (str ))
504+ # Handle invalid default IAM integrations in test environments gracefully
505+ try :
506+ dataset = client .create_dataset (name = rand_gen (str ))
507+ except ValueError as e :
508+ if "Integration is not valid" in str (e ):
509+ # Fallback to creating dataset without IAM integration for tests
510+ dataset = client .create_dataset (
511+ name = rand_gen (str ), iam_integration = None
512+ )
513+ else :
514+ raise e
505515 yield dataset
506516 dataset .delete ()
507517
508518
509519@pytest .fixture (scope = "function" )
510520def unique_dataset (client , rand_gen ):
511- dataset = client .create_dataset (name = rand_gen (str ))
521+ # Handle invalid default IAM integrations in test environments gracefully
522+ try :
523+ dataset = client .create_dataset (name = rand_gen (str ))
524+ except ValueError as e :
525+ if "Integration is not valid" in str (e ):
526+ # Fallback to creating dataset without IAM integration for tests
527+ dataset = client .create_dataset (
528+ name = rand_gen (str ), iam_integration = None
529+ )
530+ else :
531+ raise e
512532 yield dataset
513533 dataset .delete ()
514534
@@ -857,15 +877,35 @@ def func(project):
857877
858878@pytest .fixture
859879def initial_dataset (client , rand_gen ):
860- dataset = client .create_dataset (name = rand_gen (str ))
880+ # Handle invalid default IAM integrations in test environments gracefully
881+ try :
882+ dataset = client .create_dataset (name = rand_gen (str ))
883+ except ValueError as e :
884+ if "Integration is not valid" in str (e ):
885+ # Fallback to creating dataset without IAM integration for tests
886+ dataset = client .create_dataset (
887+ name = rand_gen (str ), iam_integration = None
888+ )
889+ else :
890+ raise e
861891 yield dataset
862892
863893 dataset .delete ()
864894
865895
866896@pytest .fixture
867897def video_data (client , rand_gen , video_data_row , wait_for_data_row_processing ):
868- dataset = client .create_dataset (name = rand_gen (str ))
898+ # Handle invalid default IAM integrations in test environments gracefully
899+ try :
900+ dataset = client .create_dataset (name = rand_gen (str ))
901+ except ValueError as e :
902+ if "Integration is not valid" in str (e ):
903+ # Fallback to creating dataset without IAM integration for tests
904+ dataset = client .create_dataset (
905+ name = rand_gen (str ), iam_integration = None
906+ )
907+ else :
908+ raise e
869909 data_row_ids = []
870910 data_row = dataset .create_data_row (video_data_row )
871911 data_row = wait_for_data_row_processing (client , data_row )
@@ -884,7 +924,17 @@ def create_video_data_row(rand_gen):
884924
885925@pytest .fixture
886926def video_data_100_rows (client , rand_gen , wait_for_data_row_processing ):
887- dataset = client .create_dataset (name = rand_gen (str ))
927+ # Handle invalid default IAM integrations in test environments gracefully
928+ try :
929+ dataset = client .create_dataset (name = rand_gen (str ))
930+ except ValueError as e :
931+ if "Integration is not valid" in str (e ):
932+ # Fallback to creating dataset without IAM integration for tests
933+ dataset = client .create_dataset (
934+ name = rand_gen (str ), iam_integration = None
935+ )
936+ else :
937+ raise e
888938 data_row_ids = []
889939 for _ in range (100 ):
890940 data_row = dataset .create_data_row (create_video_data_row (rand_gen ))
0 commit comments