From 6b52eb2102de666258d37f1d0adf03c831bbba36 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Wed, 4 Dec 2024 12:56:41 +0100 Subject: [PATCH] chore: skip tests if ZEN_API_KEY is not set --- .../llama-index-packs-zenguard/pyproject.toml | 2 +- .../tests/test_packs_zenguard.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/llama-index-packs/llama-index-packs-zenguard/pyproject.toml b/llama-index-packs/llama-index-packs-zenguard/pyproject.toml index d756a5ede9ea2..7de57ec2a3491 100644 --- a/llama-index-packs/llama-index-packs-zenguard/pyproject.toml +++ b/llama-index-packs/llama-index-packs-zenguard/pyproject.toml @@ -44,7 +44,7 @@ version = "0.3.0" [tool.poetry.dependencies] python = ">=3.9,<4.0" -zenguard = "^0.1.13" +zenguard = "^0.2.1" llama-index-core = "^0.12.0" [tool.poetry.group.dev.dependencies] diff --git a/llama-index-packs/llama-index-packs-zenguard/tests/test_packs_zenguard.py b/llama-index-packs/llama-index-packs-zenguard/tests/test_packs_zenguard.py index 7da9084b41d75..03597f47fe0bd 100644 --- a/llama-index-packs/llama-index-packs-zenguard/tests/test_packs_zenguard.py +++ b/llama-index-packs/llama-index-packs-zenguard/tests/test_packs_zenguard.py @@ -1,19 +1,23 @@ -import pytest - +import os from typing import Dict +import pytest from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.zenguard import ( - ZenGuardPack, - ZenGuardConfig, Credentials, Detector, + ZenGuardConfig, + ZenGuardPack, +) + +pytestmark = pytest.mark.skipif( + os.environ.get("ZEN_API_KEY") is None, reason="ZEN_API_KEY not set" ) @pytest.fixture() def zenguard_pack(): - api_key = "3Ev_DGvELv7EnlgWMTlpmWTo82tpstyz4Li_R7kTDQw" # mock key. whitelisted only for LlamaIndex tests. + api_key = os.environ.get("ZEN_API_KEY") config = ZenGuardConfig(credentials=Credentials(api_key=api_key)) return ZenGuardPack(config)