Skip to content

Commit a840a62

Browse files
committed
fix request problem
1 parent 5929172 commit a840a62

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/python_tests/conftest.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
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

Comments
 (0)