File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -147,26 +147,30 @@ def mock_read_gbq(sql, **kwargs):
147
147
148
148
@pytest .mark .single
149
149
class TestToGBQIntegrationWithServiceAccountKeyPath :
150
+ @staticmethod
151
+ def generate_rand_str (length : int = 10 ) -> str :
152
+ return "" .join (random .choices (string .ascii_lowercase , k = length ))
153
+
150
154
@pytest .fixture ()
151
155
def gbq_dataset (self ):
152
156
# Setup Dataset
153
157
_skip_if_no_project_id ()
154
158
_skip_if_no_private_key_path ()
155
159
156
- dataset_id = "pydata_pandas_bq_testing_py31"
160
+ dataset_id = "pydata_pandas_bq_testing_" + self . generate_rand_str ()
157
161
158
162
self .client = _get_client ()
159
163
self .dataset = self .client .dataset (dataset_id )
160
164
161
- # Create the dataset if it doesn't already exist
162
- self .client .create_dataset (bigquery .Dataset (self .dataset ), exists_ok = True )
165
+ # Create the dataset
166
+ self .client .create_dataset (bigquery .Dataset (self .dataset ))
163
167
164
- table_name = "" . join ( random . choices ( string . ascii_lowercase , k = 10 ) )
168
+ table_name = self . generate_rand_str ( )
165
169
destination_table = f"{ dataset_id } .{ table_name } "
166
170
yield destination_table
167
171
168
- # Teardown tables created
169
- self .client .delete_table ( destination_table , not_found_ok = True )
172
+ # Teardown Dataset
173
+ self .client .delete_dataset ( self . dataset , delete_contents = True )
170
174
171
175
def test_roundtrip (self , gbq_dataset ):
172
176
destination_table = gbq_dataset
You can’t perform that action at this time.
0 commit comments