@@ -191,23 +191,26 @@ def test_disable_cache(tmp_path, temp_working_dir):
191191
192192 os .environ ["CURATOR_DISABLE_CACHE" ] = "true"
193193
194- prompter = curator .LLM (model_name = "gpt-4o-mini" )
194+ try :
195+ prompter = curator .LLM (model_name = "gpt-4o-mini" )
195196
196- # Run twice and store results
197- with vcr_config .use_cassette ("basic_diff_cache.yaml" ):
198- result1 = prompter (["Say '1'. Do not explain." ], working_dir = str (tmp_path )).dataset
197+ # Run twice and store results
198+ with vcr_config .use_cassette ("basic_diff_cache.yaml" ):
199+ result1 = prompter (["Say '1'. Do not explain." ], working_dir = str (tmp_path )).dataset
199200
200- with vcr_config .use_cassette ("basic_diff_cache.yaml" ):
201- result2 = prompter (["Say '1'. Do not explain." ], working_dir = str (tmp_path )).dataset
201+ with vcr_config .use_cassette ("basic_diff_cache.yaml" ):
202+ result2 = prompter (["Say '1'. Do not explain." ], working_dir = str (tmp_path )).dataset
202203
203- # Verify both runs produced the expected output
204- assert result1 .to_pandas ().iloc [0 ]["response" ] == "1"
205- assert result2 .to_pandas ().iloc [0 ]["response" ] == "1"
204+ # Verify both runs produced the expected output
205+ assert result1 .to_pandas ().iloc [0 ]["response" ] == "1"
206+ assert result2 .to_pandas ().iloc [0 ]["response" ] == "1"
206207
207- # Check cache directory, excluding metadata.db
208- cache_dirs = [d for d in tmp_path .glob ("*" ) if d .name != "metadata.db" ]
208+ # Check cache directory, excluding metadata.db
209+ cache_dirs = [d for d in tmp_path .glob ("*" ) if d .name != "metadata.db" ]
209210
210- # Should have exactly 2 different cache directories
211- assert len (cache_dirs ) == 2
212- # All directories should be different (no duplicates)
213- assert len ({str (d ) for d in cache_dirs }) == 2
211+ # Should have exactly 2 different cache directories
212+ assert len (cache_dirs ) == 2
213+ # All directories should be different (no duplicates)
214+ assert len ({str (d ) for d in cache_dirs }) == 2
215+ finally :
216+ os .environ .pop ("CURATOR_DISABLE_CACHE" , None )
0 commit comments