@@ -129,7 +129,6 @@ def test_to_dict_with_parameters(self, tmp_path):
129129
130130 def test_run (self , tmp_path , mock_s3_storage , mock_boto3_session ):
131131 d = S3Downloader (file_root_path = str (tmp_path ))
132- S3Downloader .warm_up (d )
133132 d ._storage = mock_s3_storage
134133
135134 docs = [
@@ -141,7 +140,6 @@ def test_run(self, tmp_path, mock_s3_storage, mock_boto3_session):
141140
142141 def test_run_with_extensions (self , tmp_path , mock_s3_storage , mock_boto3_session ):
143142 d = S3Downloader (file_root_path = str (tmp_path ), file_extensions = [".txt" ])
144- S3Downloader .warm_up (d )
145143 d ._storage = mock_s3_storage
146144
147145 docs = [
@@ -155,25 +153,19 @@ def test_run_with_extensions(self, tmp_path, mock_s3_storage, mock_boto3_session
155153
156154 def test_run_with_input_file_meta_key (self , tmp_path , mock_s3_storage , mock_boto3_session ):
157155 d = S3Downloader (file_root_path = str (tmp_path ), file_name_meta_key = "custom_file_key" )
158- S3Downloader .warm_up (d )
159156 d ._storage = mock_s3_storage
160157
161- docs = [
162- Document (meta = {"file_id" : str (uuid4 ()), "custom_file_key" : "a.txt" }),
163- ]
158+ docs = [Document (meta = {"file_id" : str (uuid4 ()), "custom_file_key" : "a.txt" })]
164159
165160 out = d .run (documents = docs )
166161 assert len (out ["documents" ]) == 1
167162 assert out ["documents" ][0 ].meta ["custom_file_key" ] == "a.txt"
168163
169164 def test_run_with_s3_key_generation_function (self , tmp_path , mock_s3_storage , mock_boto3_session ):
170165 d = S3Downloader (file_root_path = str (tmp_path ), s3_key_generation_function = s3_key_generation_function )
171- S3Downloader .warm_up (d )
172166 d ._storage = mock_s3_storage
173167
174- docs = [
175- Document (meta = {"file_id" : str (uuid4 ()), "file_name" : "a.txt" }),
176- ]
168+ docs = [Document (meta = {"file_id" : str (uuid4 ()), "file_name" : "a.txt" })]
177169 out = d .run (documents = docs )
178170 assert len (out ["documents" ]) == 1
179171 assert out ["documents" ][0 ].meta ["file_name" ] == "a.txt"
@@ -189,7 +181,6 @@ def test_run_with_s3_key_generation_function_and_file_extensions(
189181 s3_key_generation_function = s3_key_generation_function ,
190182 file_extensions = [".txt" ],
191183 )
192- S3Downloader .warm_up (d )
193184 d ._storage = mock_s3_storage
194185
195186 docs = [
@@ -210,8 +201,6 @@ def test_run_with_s3_key_generation_function_and_file_extensions(
210201 def test_live_run (self , tmp_path , monkeypatch ):
211202 d = S3Downloader (file_root_path = str (tmp_path ))
212203 monkeypatch .setenv ("S3_DOWNLOADER_PREFIX" , "" )
213- S3Downloader .warm_up (d )
214-
215204 docs = [
216205 Document (meta = {"file_id" : str (uuid4 ()), "file_name" : "text-sample.txt" }),
217206 Document (meta = {"file_id" : str (uuid4 ()), "file_name" : "document-sample.pdf" }),
@@ -229,9 +218,7 @@ def test_live_run(self, tmp_path, monkeypatch):
229218 )
230219 def test_live_run_with_no_documents (self , tmp_path ):
231220 d = S3Downloader (file_root_path = str (tmp_path ))
232- S3Downloader .warm_up (d )
233- docs = []
234- out = d .run (documents = docs )
221+ out = d .run (documents = [])
235222 assert len (out ["documents" ]) == 0
236223
237224 @pytest .mark .integration
@@ -247,10 +234,8 @@ def test_live_run_with_no_documents(self, tmp_path):
247234 def test_live_run_with_custom_meta_key (self , tmp_path , monkeypatch ):
248235 d = S3Downloader (file_root_path = str (tmp_path ), file_name_meta_key = "custom_name" )
249236 monkeypatch .setenv ("S3_DOWNLOADER_PREFIX" , "" )
250- S3Downloader .warm_up (d )
251- docs = [
252- Document (meta = {"custom_name" : "text-sample.txt" }),
253- ]
237+ d .warm_up ()
238+ docs = [Document (meta = {"custom_name" : "text-sample.txt" })]
254239 out = d .run (documents = docs )
255240 assert len (out ["documents" ]) == 1
256241 assert out ["documents" ][0 ].meta ["custom_name" ] == "text-sample.txt"
@@ -263,11 +248,8 @@ def test_live_run_with_custom_meta_key(self, tmp_path, monkeypatch):
263248 def test_live_run_with_prefix (self , tmp_path , monkeypatch ):
264249 d = S3Downloader (file_root_path = str (tmp_path ))
265250 monkeypatch .setenv ("S3_DOWNLOADER_PREFIX" , "subfolder/" )
266-
267- S3Downloader .warm_up (d )
268- docs = [
269- Document (meta = {"file_name" : "employees.json" }),
270- ]
251+ d .warm_up ()
252+ docs = [Document (meta = {"file_name" : "employees.json" })]
271253 out = d .run (documents = docs )
272254 assert len (out ["documents" ]) == 1
273255 assert out ["documents" ][0 ].meta ["file_name" ] == "employees.json"
@@ -286,10 +268,8 @@ def test_live_run_with_s3_key_generation_function_and_file_extensions(self, tmp_
286268 file_name_meta_key = "file_name" ,
287269 s3_key_generation_function = s3_key_generation_function ,
288270 )
289- S3Downloader .warm_up (d )
290- docs = [
291- Document (meta = {"file_name" : "dog.jpg" }),
292- ]
271+ d .warm_up ()
272+ docs = [Document (meta = {"file_name" : "dog.jpg" })]
293273 out = d .run (documents = docs )
294274 assert len (out ["documents" ]) == 1
295275 assert out ["documents" ][0 ].meta ["file_name" ] == "dog.jpg"
0 commit comments