Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add invenio-cache (Redis) fixture #30

Open
2 tasks done
slint opened this issue Feb 1, 2019 · 2 comments
Open
2 tasks done

Add invenio-cache (Redis) fixture #30

slint opened this issue Feb 1, 2019 · 2 comments

Comments

@slint
Copy link
Member

slint commented Feb 1, 2019

It would be useful to have invenio-cache (or Redis) fixtures to be able to:

  • Clear all keys with pefix CACHE_KEY_REFIX
  • Clear the entire Redis instance (e.g. with FLUSHALL)

Another interesting alternative is specifying a custom CACHE_KEY_PREFIX for testing (e.g. 'tests::cache::') and clear only this one.

@jorikvankemenade jorikvankemenade removed their assignment May 18, 2021
@ppanero
Copy link
Member

ppanero commented Oct 27, 2021

An ad-hoc fixture has been placed in invenio-record-resources, invenio-vocabularies and invenio-rdm-records, remove from there when fixing this issue:

@pytest.fixture()
def cache():
    """Empty cache."""
    try:
        current_cache.clear()
        yield current_cache
    finally:
        current_cache.clear()

@ppanero ppanero self-assigned this Oct 27, 2021
@ppanero ppanero removed their assignment Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants