Skip to content

Commit

Permalink
skip cosmos test
Browse files Browse the repository at this point in the history
  • Loading branch information
WaelKarkoub committed Apr 28, 2024
1 parent be36a57 commit f8c0d7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Test with Cosmos DB
run: |
pip install -e .[test,cosmosdb]
coverage run -a -m pytest test/cache/test_cosmos_db_cache.py --skip-openai --durations=10 --durations-min=1.0
pytest test/cache/test_cosmos_db_cache.py --skip-openai --durations=10 --durations-min=1.0
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v3
Expand Down
21 changes: 15 additions & 6 deletions test/cache/test_cosmos_db_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@
import unittest
from unittest.mock import MagicMock, patch

from azure.cosmos.exceptions import CosmosResourceNotFoundError
try:
from azure.cosmos.exceptions import CosmosResourceNotFoundError

skip_test = False
except ImportError:
skip_test = True
CosmosResourceNotFoundError = None

from autogen.cache.cosmos_db_cache import CosmosDBCache


class TestCosmosDBCache(unittest.TestCase):
def setUp(self):
self.seed = "42"
self.connection_string = "AccountEndpoint=https://example.documents.azure.com:443/;"
self.database_id = "autogen_cache"
self.container_id = "TestContainer"
self.client = MagicMock()
if skip_test:
self.skipTest("requires azure.cosmos")
else:
self.seed = "42"
self.connection_string = "AccountEndpoint=https://example.documents.azure.com:443/;"
self.database_id = "autogen_cache"
self.container_id = "TestContainer"
self.client = MagicMock()

@patch("autogen.cache.cosmos_db_cache.CosmosClient.from_connection_string", return_value=MagicMock())
def test_init(self, mock_from_connection_string):
Expand Down

0 comments on commit f8c0d7c

Please sign in to comment.