Skip to content

Commit 94835b5

Browse files
author
Andrew Lapp
committed
ensure we reset cache at start of test
1 parent 15e2349 commit 94835b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_cache.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,15 @@ def f(x):
117117
def test_version_upgrade_cache_invalidate(test_cache, mocker):
118118
"""Ensure we can change the signature of a cached function if we upgrade the version"""
119119

120+
import outlines.caching
121+
120122
def simulate_restart_outlines():
121123
# clearing in-memory lru_cache which returns the diskcache in
122124
# order to simulate a reload, we're not clearing the diskcache itself
123125
outlines.caching.get_cache.cache_clear()
124126

125-
import outlines.caching
126-
127127
mocker.patch("outlines._version.__version__", new="0.0.0")
128+
simulate_restart_outlines()
128129

129130
# initialize cache with signature of Tuple-of-3
130131
@test_cache

0 commit comments

Comments
 (0)