3030from tests .conftest import BQ_TABLE_METADATA_LOCATION_REGEX
3131
3232
33+ @pytest .mark .skipif (os .environ .get ("GCP_CREDENTIALS" ) is None )
3334def test_create_table_with_database_location (
3435 mocker : MockFixture , _bucket_initialize : None , table_schema_nested : Schema , gcp_dataset_name : str , table_name : str
3536) -> None :
@@ -38,7 +39,12 @@ def test_create_table_with_database_location(
3839 catalog_name = "test_ddb_catalog"
3940 identifier = (gcp_dataset_name , table_name )
4041 test_catalog = BigQueryMetastoreCatalog (
41- catalog_name , ** {"gcp.project-id" : "alexstephen-test-1" , "warehouse" : "gs://alexstephen-test-bq-bucket/" }
42+ catalog_name ,
43+ ** {
44+ "gcp.bigquery.project-id" : "alexstephen-test-1" ,
45+ "warehouse" : "gs://alexstephen-test-bq-bucket/" ,
46+ "gcp.bigquery.credentials-info" : os .environ ["GCP_CREDENTIALS" ],
47+ },
4248 )
4349 test_catalog .create_namespace (namespace = gcp_dataset_name )
4450 table = test_catalog .create_table (identifier , table_schema_nested )
@@ -49,6 +55,7 @@ def test_create_table_with_database_location(
4955 assert identifier in tables_in_namespace
5056
5157
58+ @pytest .mark .skipif (os .environ .get ("GCP_CREDENTIALS" ) is None )
5259def test_drop_table_with_database_location (
5360 mocker : MockFixture , _bucket_initialize : None , table_schema_nested : Schema , gcp_dataset_name : str , table_name : str
5461) -> None :
@@ -57,7 +64,12 @@ def test_drop_table_with_database_location(
5764 catalog_name = "test_ddb_catalog"
5865 identifier = (gcp_dataset_name , table_name )
5966 test_catalog = BigQueryMetastoreCatalog (
60- catalog_name , ** {"gcp.project-id" : "alexstephen-test-1" , "warehouse" : "gs://alexstephen-test-bq-bucket/" }
67+ catalog_name ,
68+ ** {
69+ "gcp.bigquery.project-id" : "alexstephen-test-1" ,
70+ "warehouse" : "gs://alexstephen-test-bq-bucket/" ,
71+ "gcp.bigquery.credentials-info" : os .environ ["GCP_CREDENTIALS" ],
72+ },
6173 )
6274 test_catalog .create_namespace (namespace = gcp_dataset_name )
6375 test_catalog .create_table (identifier , table_schema_nested )
@@ -74,6 +86,7 @@ def test_drop_table_with_database_location(
7486 assert True
7587
7688
89+ @pytest .mark .skipif (os .environ .get ("GCP_CREDENTIALS" ) is None )
7790def test_create_and_drop_namespace (
7891 mocker : MockFixture , _bucket_initialize : None , table_schema_nested : Schema , gcp_dataset_name : str , table_name : str
7992) -> None :
@@ -82,7 +95,12 @@ def test_create_and_drop_namespace(
8295 # Create namespace.
8396 catalog_name = "test_ddb_catalog"
8497 test_catalog = BigQueryMetastoreCatalog (
85- catalog_name , ** {"gcp.project-id" : "alexstephen-test-1" , "warehouse" : "gs://alexstephen-test-bq-bucket/" }
98+ catalog_name ,
99+ ** {
100+ "gcp.bigquery.project-id" : "alexstephen-test-1" ,
101+ "warehouse" : "gs://alexstephen-test-bq-bucket/" ,
102+ "gcp.bigquery.credentials-info" : os .environ ["GCP_CREDENTIALS" ],
103+ },
86104 )
87105 test_catalog .create_namespace (namespace = gcp_dataset_name )
88106
@@ -100,6 +118,7 @@ def test_create_and_drop_namespace(
100118 test_catalog .load_namespace_properties (gcp_dataset_name )
101119
102120
121+ @pytest .mark .skipif (os .environ .get ("GCP_CREDENTIALS" ) is None )
103122def test_register_table (
104123 mocker : MockFixture , _bucket_initialize : None , table_schema_nested : Schema , gcp_dataset_name : str , table_name : str
105124) -> None :
@@ -108,9 +127,15 @@ def test_register_table(
108127 catalog_name = "test_bq_register_catalog"
109128 identifier = (gcp_dataset_name , table_name )
110129 warehouse_path = "gs://alexstephen-test-bq-bucket/" # Matches conftest BUCKET_NAME for GCS interaction
111- gcp_project_id = "alexstephen-test-1"
112130
113- test_catalog = BigQueryMetastoreCatalog (catalog_name , ** {"gcp.project-id" : gcp_project_id , "warehouse" : warehouse_path })
131+ test_catalog = BigQueryMetastoreCatalog (
132+ catalog_name ,
133+ ** {
134+ "gcp.bigquery.project-id" : "alexstephen-test-1" ,
135+ "warehouse" : "gs://alexstephen-test-bq-bucket/" ,
136+ "gcp.bigquery.credentials-info" : os .environ ["GCP_CREDENTIALS" ],
137+ },
138+ )
114139
115140 test_catalog .create_namespace (namespace = gcp_dataset_name )
116141
0 commit comments