3030
3131
3232@pytest .fixture (scope = "session" , autouse = True )
33- def setup_and_teardown (cache , tmp_path_factory ):
33+ def setup_and_teardown (request , tmp_path_factory ):
3434 """Fixture to set up and tear down the temporary directories."""
3535
3636 ov_cache_models_dir = get_ov_cache_models_dir ()
@@ -47,9 +47,16 @@ def setup_and_teardown(cache, tmp_path_factory):
4747 os .makedirs (models_dir , exist_ok = True )
4848 os .makedirs (test_data , exist_ok = True )
4949
50- cache .set ("OV_CACHE" , str (ov_cache ))
51- cache .set ("MODELS_DIR" , str (models_dir ))
52- cache .set ("TEST_DATA" , str (test_data ))
50+ cache = getattr (request .config , "cache" , None )
51+ if cache is not None :
52+ cache .set ("OV_CACHE" , str (ov_cache ))
53+ cache .set ("MODELS_DIR" , str (models_dir ))
54+ cache .set ("TEST_DATA" , str (test_data ))
55+ else :
56+ # fallback (macOS without cache plugin)
57+ os .environ ["OV_CACHE" ] = str (ov_cache )
58+ os .environ ["MODELS_DIR" ] = str (models_dir )
59+ os .environ ["TEST_DATA" ] = str (test_data )
5360
5461 yield
5562
0 commit comments