From 63a6041c7a223c4b33060cc5795d4fe690452732 Mon Sep 17 00:00:00 2001
From: James Briggs <james.briggs@hotmail.com>
Date: Sat, 9 Nov 2024 21:29:32 +0100
Subject: [PATCH] fix: skip if no pinecone api key

---
 tests/unit/test_sync.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/unit/test_sync.py b/tests/unit/test_sync.py
index 83988d5c..b748354e 100644
--- a/tests/unit/test_sync.py
+++ b/tests/unit/test_sync.py
@@ -190,6 +190,9 @@ def get_test_indexes():
 
 @pytest.mark.parametrize("index_cls", get_test_indexes())
 class TestRouteLayer:
+    @pytest.mark.skipif(
+        os.environ.get("PINECONE_API_KEY") is None, reason="Pinecone API key required"
+    )
     def test_initialization(self, openai_encoder, routes, index_cls):
         index = init_index(index_cls)
         _ = RouteLayer(
@@ -198,6 +201,9 @@ class TestRouteLayer:
         if index_cls is PineconeIndex:
             time.sleep(PINECONE_SLEEP)  # allow for index to be populated
 
+    @pytest.mark.skipif(
+        os.environ.get("PINECONE_API_KEY") is None, reason="Pinecone API key required"
+    )
     def test_second_initialization_sync(self, openai_encoder, routes, index_cls):
         index = init_index(index_cls)
         route_layer = RouteLayer(
@@ -205,6 +211,9 @@ class TestRouteLayer:
         )
         assert route_layer.is_synced()
 
+    @pytest.mark.skipif(
+        os.environ.get("PINECONE_API_KEY") is None, reason="Pinecone API key required"
+    )
     def test_second_initialization_not_synced(self, openai_encoder, routes_2, index_cls):
         index = init_index(index_cls)
         route_layer = RouteLayer(
@@ -212,6 +221,9 @@ class TestRouteLayer:
         )
         assert not route_layer.is_synced()
 
+    @pytest.mark.skipif(
+        os.environ.get("PINECONE_API_KEY") is None, reason="Pinecone API key required"
+    )
     def test_utterance_diff(self, openai_encoder, routes_2, index_cls):
         index = init_index(index_cls)
 
-- 
GitLab