diff --git a/lib/cli/tests/test_plus_api.py b/lib/cli/tests/test_plus_api.py index 1ee4eb7af..e13082dab 100644 --- a/lib/cli/tests/test_plus_api.py +++ b/lib/cli/tests/test_plus_api.py @@ -17,7 +17,7 @@ class TestPlusAPI(unittest.TestCase): self.assertEqual(self.api.api_key, self.api_key) self.assertEqual(self.api.headers["Authorization"], f"Bearer {self.api_key}") self.assertEqual(self.api.headers["Content-Type"], "application/json") - self.assertTrue("CrewAI-CLI/" in self.api.headers["User-Agent"]) + self.assertIn("CrewAI-CLI/", self.api.headers["User-Agent"]) self.assertTrue(self.api.headers["X-Crewai-Version"]) @patch("crewai_cli.plus_api.PlusAPI._make_request") diff --git a/lib/cli/tests/test_token_manager.py b/lib/cli/tests/test_token_manager.py index 1cc14abdf..84ca65889 100644 --- a/lib/cli/tests/test_token_manager.py +++ b/lib/cli/tests/test_token_manager.py @@ -1,7 +1,6 @@ """Tests for TokenManager with atomic file operations.""" import json -import os import tempfile import unittest from datetime import datetime, timedelta diff --git a/lib/crewai/src/crewai/auth/providers/base_provider.py b/lib/crewai/src/crewai/auth/providers/base_provider.py index d69d8d673..926e3ca1d 100644 --- a/lib/crewai/src/crewai/auth/providers/base_provider.py +++ b/lib/crewai/src/crewai/auth/providers/base_provider.py @@ -12,22 +12,28 @@ class BaseProvider(ABC): self.settings = settings @abstractmethod - def get_authorize_url(self) -> str: ... + def get_authorize_url(self) -> str: + """Return the authorization endpoint URL.""" @abstractmethod - def get_token_url(self) -> str: ... + def get_token_url(self) -> str: + """Return the token endpoint URL.""" @abstractmethod - def get_jwks_url(self) -> str: ... + def get_jwks_url(self) -> str: + """Return the JWKS endpoint URL.""" @abstractmethod - def get_issuer(self) -> str: ... + def get_issuer(self) -> str: + """Return the OAuth issuer identifier.""" @abstractmethod - def get_audience(self) -> str: ... + def get_audience(self) -> str: + """Return the OAuth audience identifier.""" @abstractmethod - def get_client_id(self) -> str: ... + def get_client_id(self) -> str: + """Return the OAuth client identifier.""" def get_required_fields(self) -> list[str]: """Returns which provider-specific fields inside the "extra" dict will be required.""" diff --git a/lib/crewai/src/crewai/auth/token_manager.py b/lib/crewai/src/crewai/auth/token_manager.py index 9f1807d33..5ab5eb801 100644 --- a/lib/crewai/src/crewai/auth/token_manager.py +++ b/lib/crewai/src/crewai/auth/token_manager.py @@ -182,7 +182,4 @@ class TokenManager: """ storage_path = self._get_secure_storage_path() file_path = storage_path / filename - try: - file_path.unlink() - except FileNotFoundError: - pass + file_path.unlink(missing_ok=True) diff --git a/lib/crewai/tests/llms/openai/test_openai.py b/lib/crewai/tests/llms/openai/test_openai.py index b68d9bd1c..746729edb 100644 --- a/lib/crewai/tests/llms/openai/test_openai.py +++ b/lib/crewai/tests/llms/openai/test_openai.py @@ -11,7 +11,6 @@ from crewai.llms.providers.openai.completion import OpenAICompletion, ResponsesA from crewai.crew import Crew from crewai.agent import Agent from crewai.task import Task -from crewai.constants import DEFAULT_LLM_MODEL def test_openai_completion_is_used_when_openai_provider(): """