Skip to content

Commit

Permalink
mock reset
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Aug 27, 2024
1 parent 4f3fb15 commit 0eaa56a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ def reset_loglevel(request, caplog):
yield


@pytest.fixture(autouse=True, scope="session")
def mocked_diskcache_reset(session_mocker):
from diskcache import ENOVAL
from diskcache.core import DEFAULT_SETTINGS

def reset(self, key, value=..., update=True):
if not hasattr(self, "_settings"):
self._settings = DEFAULT_SETTINGS.copy()
if value is ENOVAL:
return getattr(self, key, self._settings[key])
if update:
setattr(self, key, value)
self._settings[key] = value

return session_mocker.patch("diskcache.core.Cache.reset", reset)


@pytest.fixture(autouse=True)
def enable_ui():
from dvc.ui import ui
Expand Down

0 comments on commit 0eaa56a

Please sign in to comment.