@@ -281,54 +281,42 @@ def _check_fold_timing_evaluations( # noqa: PLR0913
281281 assert evaluation <= max_val
282282
283283
284- class TestAPIBase (unittest .TestCase ):
285- retries : int
286- retry_policy : RetryPolicy
287- ttl : int
288- cache_dir : Path
284+ class TestAPIBase (TestBase ):
289285 cache : HTTPCache
290286 http_clients : dict [APIVersion , HTTPClient ]
291287 minio_client : MinIOClient
292- current_api_version : APIVersion | None
293288
294- def setUp (self ) -> None :
295- config = openml ._backend .get_config ()
296-
297- self .retries = config .connection .retries
298- self .retry_policy = config .connection .retry_policy
299- self .ttl = config .cache .ttl
300- self .current_api_version = None
289+ def setUp (self , n_levels : int = 1 , tmpdir_suffix : str = "" ) -> None :
290+ super ().setUp (n_levels = n_levels , tmpdir_suffix = tmpdir_suffix )
301291
302- abspath_this_file = Path (inspect .getfile (self .__class__ )).absolute ()
303- self .cache_dir = abspath_this_file .parent .parent / "files"
304- if not self .cache_dir .is_dir ():
305- raise ValueError (
306- f"Cannot find test cache dir, expected it to be { self .cache_dir } !" ,
307- )
292+ retries = self .connection_n_retries
293+ retry_policy = RetryPolicy .HUMAN if self .retry_policy == "human" else RetryPolicy .ROBOT
294+ ttl = openml ._backend .get_config_value ("cache.ttl" )
295+ cache_dir = self .static_cache_dir
308296
309297 self .cache = HTTPCache (
310- path = self . cache_dir ,
311- ttl = self . ttl ,
298+ path = cache_dir ,
299+ ttl = ttl ,
312300 )
313301 self .http_clients = {
314302 APIVersion .V1 : HTTPClient (
315303 server = "https://test.openml.org/" ,
316304 base_url = "api/v1/xml/" ,
317305 api_key = "normaluser" ,
318- retries = self . retries ,
319- retry_policy = self . retry_policy ,
306+ retries = retries ,
307+ retry_policy = retry_policy ,
320308 cache = self .cache ,
321309 ),
322310 APIVersion .V2 : HTTPClient (
323311 server = "http://localhost:8002/" ,
324312 base_url = "" ,
325313 api_key = "" ,
326- retries = self . retries ,
327- retry_policy = self . retry_policy ,
314+ retries = retries ,
315+ retry_policy = retry_policy ,
328316 cache = self .cache ,
329317 ),
330318 }
331- self .minio_client = MinIOClient (path = self . cache_dir )
319+ self .minio_client = MinIOClient (path = cache_dir )
332320
333321
334322def check_task_existence (
0 commit comments