@@ -30,7 +30,7 @@ def default_response():
3030
3131
3232def test_default_filename_from_uri (default_response ):
33- cd = CacheDownloader ().bind ("https://example.com/schema1.json" )
33+ cd = CacheDownloader ("downloads" ).bind ("https://example.com/schema1.json" )
3434 assert cd ._filename == "schema1.json"
3535
3636
@@ -76,7 +76,7 @@ def fake_expanduser(path):
7676 monkeypatch .setattr (platform , "system" , fakesystem )
7777 monkeypatch .setattr (os .path , "expanduser" , fake_expanduser )
7878
79- cd = CacheDownloader ()
79+ cd = CacheDownloader ("downloads" )
8080 assert cd ._cache_dir == expect_value
8181
8282 if sysname == "Darwin" :
@@ -114,7 +114,7 @@ def test_cachedownloader_cached_file(tmp_path, monkeypatch, default_response):
114114 f .write_text ("{}" )
115115
116116 # set the cache_dir to the tmp dir (so that cache_dir will always be set)
117- cd = CacheDownloader (cache_dir = tmp_path ).bind (str (f ))
117+ cd = CacheDownloader (tmp_path ).bind (str (f ))
118118 # patch the downloader to skip any download "work"
119119 monkeypatch .setattr (
120120 cd ._downloader , "_download" , lambda file_uri , filename , response_ok : str (f )
@@ -128,7 +128,7 @@ def test_cachedownloader_cached_file(tmp_path, monkeypatch, default_response):
128128def test_cachedownloader_on_success (get_download_cache_loc , disable_cache ):
129129 add_default_response ()
130130 f = get_download_cache_loc ("schema1.json" )
131- cd = CacheDownloader (disable_cache = disable_cache ).bind (
131+ cd = CacheDownloader ("downloads" , disable_cache = disable_cache ).bind (
132132 "https://example.com/schema1.json"
133133 )
134134
@@ -171,7 +171,7 @@ def test_cachedownloader_succeeds_after_few_errors(
171171 )
172172 add_default_response ()
173173 f = get_download_cache_loc ("schema1.json" )
174- cd = CacheDownloader (disable_cache = disable_cache ).bind (
174+ cd = CacheDownloader ("downloads" , disable_cache = disable_cache ).bind (
175175 "https://example.com/schema1.json"
176176 )
177177
@@ -205,7 +205,7 @@ def test_cachedownloader_fails_after_many_errors(
205205 )
206206 add_default_response () # never reached, the 11th response
207207 f = get_download_cache_loc ("schema1.json" )
208- cd = CacheDownloader (disable_cache = disable_cache ).bind (
208+ cd = CacheDownloader ("downloads" , disable_cache = disable_cache ).bind (
209209 "https://example.com/schema1.json"
210210 )
211211 with pytest .raises (FailedDownloadError ):
@@ -226,6 +226,7 @@ def test_cachedownloader_retries_on_bad_data(get_download_cache_loc, disable_cac
226226 add_default_response ()
227227 f = get_download_cache_loc ("schema1.json" )
228228 cd = CacheDownloader (
229+ "downloads" ,
229230 disable_cache = disable_cache ,
230231 ).bind (
231232 "https://example.com/schema1.json" ,
@@ -281,7 +282,7 @@ def fake_mktime(*args):
281282 if file_exists :
282283 inject_cached_download (uri , original_file_contents )
283284
284- cd = CacheDownloader ().bind (uri )
285+ cd = CacheDownloader ("downloads" ).bind (uri )
285286
286287 # if the file already existed, it will not be overwritten by the cachedownloader
287288 # so the returned value for both the downloader and a direct file read should be the
@@ -326,7 +327,7 @@ def dummy_validate_bytes(data):
326327
327328 # construct a downloader pointed at the schema and file, expecting a cache hit
328329 # and use the above validation method
329- cd = CacheDownloader ().bind (
330+ cd = CacheDownloader ("downloads" ).bind (
330331 "https://example.com/schema1.json" ,
331332 validation_callback = dummy_validate_bytes ,
332333 )
0 commit comments