33
44import os
55import unittest .mock
6+ from pathlib import Path
67import shutil
78from time import time
89
@@ -236,15 +237,15 @@ def test_get_data_corrupt_pickle(self):
236237
237238 def test_lazy_loading_metadata (self ):
238239 # Initial Setup
239- cache_dir = openml . config . get_cache_directory ()
240+ did_cache_dir = Path ( self . http_client . cache_path_from_url ( "data/2" )). parent
240241
241242 _compare_dataset = openml .datasets .get_dataset (
242243 2 ,
243244 download_data = False ,
244245 download_features_meta_data = True ,
245246 download_qualities = True ,
246247 )
247- change_time = os .stat (cache_dir ).st_mtime
248+ change_time = os .stat (did_cache_dir ).st_mtime
248249
249250 # Test with cache
250251 _dataset = openml .datasets .get_dataset (
@@ -253,12 +254,12 @@ def test_lazy_loading_metadata(self):
253254 download_features_meta_data = False ,
254255 download_qualities = False ,
255256 )
256- assert change_time == os .stat (cache_dir ).st_mtime
257+ assert change_time == os .stat (did_cache_dir ).st_mtime
257258 assert _dataset .features == _compare_dataset .features
258259 assert _dataset .qualities == _compare_dataset .qualities
259260
260261 # -- Test without cache
261- shutil .rmtree (cache_dir )
262+ shutil .rmtree (did_cache_dir )
262263
263264 _dataset = openml .datasets .get_dataset (
264265 2 ,
@@ -267,7 +268,8 @@ def test_lazy_loading_metadata(self):
267268 download_qualities = False ,
268269 )
269270
270- assert change_time != os .stat (cache_dir ).st_mtime
271+ assert "body.xml" in os .listdir (did_cache_dir )
272+ assert change_time != os .stat (did_cache_dir ).st_mtime
271273 assert _dataset .features == _compare_dataset .features
272274 assert _dataset .qualities == _compare_dataset .qualities
273275
0 commit comments