Files
Danglewood 869cfed125 [Release] openbb-v5.0.0 (#7741)
* merge branch develop with main

* bump desktop version

* fix the merge

* sync Cargo.lock to desktop 2.0.0

* fix cli conftest.py

---------

Co-authored-by: deeleeramone <>
2026-09-29 10:58:44 -07:00

38 lines
1.0 KiB
Python

"""Shared fixtures for the FRED provider tests."""
import os
import pytest
@pytest.fixture(scope="session", autouse=True)
def fred_cache(tmp_path_factory):
"""Give the run its own FRED response cache, and empty it at the end."""
from openbb_fred.utils import cache
from openbb_fred.utils.rate_limiter import cache_clear
directory = tmp_path_factory.mktemp("fred-cache")
previous = os.environ.get("OPENBB_FRED_DISK_CACHE_DIR")
os.environ["OPENBB_FRED_DISK_CACHE_DIR"] = str(directory)
cache.close()
cache_clear()
yield cache
cache.clear()
cache.close()
cache_clear()
if previous is None:
os.environ.pop("OPENBB_FRED_DISK_CACHE_DIR", None)
else:
os.environ["OPENBB_FRED_DISK_CACHE_DIR"] = previous
@pytest.fixture(autouse=True)
def no_request_spacing(monkeypatch):
"""Replay recorded requests without the live API's request spacing."""
from openbb_fred.utils import rate_limiter
monkeypatch.setattr(rate_limiter, "MIN_INTERVAL_SECONDS", 0.0)