1- from concurrent .futures import ProcessPoolExecutor
21import json
3- from multiprocessing import cpu_count
42from pathlib import Path
53from typing import Any , Dict , List , Tuple
64
3230 temp_xml_file ,
3331)
3432
35- @pytest .fixture (scope = "module" )
36- def temp_process_pool_executor ():
37- with ProcessPoolExecutor (cpu_count () - 1 ) as pool :
38- yield pool
3933
40-
41- def test_duckdb_data_contract_csv (temp_csv_file , temp_process_pool_executor ):
34+ def test_duckdb_data_contract_csv (temp_csv_file ):
4235 uri , _ , _ , mdl = temp_csv_file
4336 connection = default_connection
4437
@@ -97,7 +90,7 @@ def test_duckdb_data_contract_csv(temp_csv_file, temp_process_pool_executor):
9790 }
9891 entity_locations : Dict [str , URI ] = {"test_ds" : str (uri )}
9992
100- data_contract : DuckDBDataContract = DuckDBDataContract (connection , executor = temp_process_pool_executor )
93+ data_contract : DuckDBDataContract = DuckDBDataContract (connection )
10194 entities , feedback_errors_uri , stage_successful = data_contract .apply_data_contract (get_parent (uri .as_posix ()), entities , entity_locations , dc_meta )
10295 rel : DuckDBPyRelation = entities .get ("test_ds" )
10396 assert dict (zip (rel .columns , rel .dtypes )) == {
@@ -108,7 +101,7 @@ def test_duckdb_data_contract_csv(temp_csv_file, temp_process_pool_executor):
108101 assert stage_successful
109102
110103
111- def test_duckdb_data_contract_xml (temp_xml_file , temp_process_pool_executor ):
104+ def test_duckdb_data_contract_xml (temp_xml_file ):
112105 uri , header_model , header_data , class_model , class_data = temp_xml_file
113106 connection = default_connection
114107 contract_meta = json .dumps (
@@ -195,7 +188,7 @@ def test_duckdb_data_contract_xml(temp_xml_file, temp_process_pool_executor):
195188 reporting_fields = {"test_header" : ["school" ], "test_class_info" : ["year" ]},
196189 )
197190
198- data_contract : DuckDBDataContract = DuckDBDataContract (connection , executor = temp_process_pool_executor )
191+ data_contract : DuckDBDataContract = DuckDBDataContract (connection )
199192 entities , feedback_errors_uri , stage_successful = data_contract .apply_data_contract (get_parent (uri .as_posix ()), entities , entity_locations , dc_meta )
200193 header_rel : DuckDBPyRelation = entities .get ("test_header" )
201194 header_expected_schema : Dict [str , DuckDBPyType ] = {
@@ -335,11 +328,10 @@ def test_ddb_data_contract_read_nested_parquet(nested_all_string_parquet):
335328 }
336329
337330def test_duckdb_data_contract_custom_error_details (nested_all_string_parquet_w_errors ,
338- nested_parquet_custom_dc_err_details ,
339- temp_process_pool_executor ):
331+ nested_parquet_custom_dc_err_details ):
340332 parquet_uri , contract_meta , _ = nested_all_string_parquet_w_errors
341333 connection = default_connection
342- data_contract = DuckDBDataContract (connection , executor = temp_process_pool_executor )
334+ data_contract = DuckDBDataContract (connection )
343335
344336 entity = data_contract .read_parquet (path = parquet_uri )
345337 assert entity .count ("*" ).fetchone ()[0 ] == 2
0 commit comments