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

fixtures: add fixture for cache_uri #115

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pytest_invenio/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is part of pytest-invenio.
# Copyright (C) 2017-2024 CERN.
# Copyright (C) 2018 Esteban J. G. Garbancho.
# Copyright (C) 2024 Graz University of Technology.
# Copyright (C) 2024-2025 Graz University of Technology.
#
# pytest-invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -69,6 +69,15 @@ def instance_path():
shutil.rmtree(path)


@pytest.fixture(scope="module")
def cache_uri():
"""Cache uri."""
if "CACHE_REDIS_URL" in os.environ:
yield os.environ["CACHE_REDIS_URL"]
else:
yield None


@pytest.fixture(scope="module")
def db_uri(instance_path):
"""Database URI (defaults to an SQLite datbase in the instance path).
Expand Down
2 changes: 2 additions & 0 deletions pytest_invenio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of pytest-invenio.
# Copyright (C) 2017-2018 CERN.
# Copyright (C) 2018 Northwestern University, Feinberg School of Medicine,
# Copyright (C) 2025 Graz University of Technology.
# Galter Health Sciences Library.
#
# pytest-invenio is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -33,6 +34,7 @@
broker_uri,
browser,
bucket_from_dir,
cache_uri,
celery_config,
celery_config_ext,
cli_runner,
Expand Down
Loading