diff --git a/tests/conftest.py b/tests/conftest.py index 6398d7d..e9fe7b5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,6 +5,7 @@ import io import structlog from nvchecker.get_version import get_version as _get_version +from nvchecker.get_version import _cache from nvchecker.core import Source class TestSource(Source): @@ -22,7 +23,10 @@ class TestSource(Source): self._future.set_exception(exc) @pytest.fixture(scope="module") -async def run_source(): +async def run_source(*, clear_cache=False): + if clear_cache: + _cache.clear() + async def __call__(conf): future = asyncio.Future() file = io.StringIO(conf) diff --git a/tests/test_keyfile.py b/tests/test_keyfile.py index 09346f4..2eec251 100644 --- a/tests/test_keyfile.py +++ b/tests/test_keyfile.py @@ -46,7 +46,7 @@ keyfile = {name} '''.format(name=f.name) try: - version = await run_source(test_conf) + version = await run_source(test_conf, clear_cache=True) assert version is None # out of allowance return except HTTPError as e: