pytest-llm-assert 0.1.1__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/PKG-INFO +1 -1
  2. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/pyproject.toml +1 -1
  3. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/core.py +24 -23
  4. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/uv.lock +1 -1
  5. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.env.example +0 -0
  6. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/CODEOWNERS +0 -0
  7. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  8. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  9. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  10. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  11. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/dependabot.yml +0 -0
  12. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/ci.yml +0 -0
  13. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/codeql.yml +0 -0
  14. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/dependency-review.yml +0 -0
  15. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/release.yml +0 -0
  16. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.github/workflows/stale.yml +0 -0
  17. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.gitignore +0 -0
  18. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/.pre-commit-config.yaml +0 -0
  19. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/CODE_OF_CONDUCT.md +0 -0
  20. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/CONTRIBUTING.md +0 -0
  21. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/LICENSE +0 -0
  22. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/README.md +0 -0
  23. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/SECURITY.md +0 -0
  24. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/GITHUB_SETUP_GUIDE.md +0 -0
  25. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/README.md +0 -0
  26. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/api-reference.md +0 -0
  27. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/comparing-models.md +0 -0
  28. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/docs/configuration.md +0 -0
  29. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/README.md +0 -0
  30. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/conftest.py +0 -0
  31. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/pytest_conftest.py +0 -0
  32. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/test_basic.py +0 -0
  33. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/examples/test_compare_models.py +0 -0
  34. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/__init__.py +0 -0
  35. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/plugin.py +0 -0
  36. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/src/pytest_llm_assert/prompts/system_prompt.md +0 -0
  37. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/__init__.py +0 -0
  38. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/integration/__init__.py +0 -0
  39. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/integration/test_llm_integration.py +0 -0
  40. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/__init__.py +0 -0
  41. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_assertion_result.py +0 -0
  42. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_azure_auth.py +0 -0
  43. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_error_handling.py +0 -0
  44. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_fixture_integration.py +0 -0
  45. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_llm_assert_core.py +0 -0
  46. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_llm_response.py +0 -0
  47. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_plugin.py +0 -0
  48. {pytest_llm_assert-0.1.1 → pytest_llm_assert-0.2.0}/tests/unit/test_response_parsing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-llm-assert
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: Simple LLM-powered assertions for any pytest test
5
5
  Project-URL: Homepage, https://github.com/sbroenne/pytest-llm-assert
6
6
  Project-URL: Documentation, https://github.com/sbroenne/pytest-llm-assert#readme
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pytest-llm-assert"
7
- version = "0.1.1"
7
+ version = "0.2.0"
8
8
  description = "Simple LLM-powered assertions for any pytest test"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -2,7 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- import functools
6
5
  import json
7
6
  import os
8
7
  import re
@@ -20,27 +19,6 @@ if TYPE_CHECKING:
20
19
  from typing import Any
21
20
 
22
21
 
23
- @functools.cache
24
- def _get_azure_ad_token_provider() -> Callable[[], str] | None:
25
- """Get Azure AD token provider for Entra ID authentication.
26
-
27
- Uses LiteLLM's built-in helper which leverages DefaultAzureCredential.
28
- Cached at module level to avoid recreating credentials on each call.
29
- """
30
- try:
31
- from litellm.secret_managers.get_azure_ad_token_provider import (
32
- get_azure_ad_token_provider,
33
- )
34
-
35
- return get_azure_ad_token_provider()
36
- except ImportError:
37
- # azure-identity not installed
38
- return None
39
- except Exception:
40
- # Credential not available
41
- return None
42
-
43
-
44
22
  @dataclass(slots=True)
45
23
  class LLMResponse:
46
24
  """Response details from the last LLM call.
@@ -115,7 +93,7 @@ class LLMAssert:
115
93
 
116
94
  # Auto-configure Azure Entra ID when no API key is provided
117
95
  if self._is_azure_model() and not self._has_azure_api_key():
118
- self._azure_ad_token_provider = _get_azure_ad_token_provider()
96
+ self._azure_ad_token_provider = self._get_azure_ad_token_provider()
119
97
 
120
98
  def _is_azure_model(self) -> bool:
121
99
  """Check if the model is an Azure OpenAI model."""
@@ -125,6 +103,29 @@ class LLMAssert:
125
103
  """Check if an Azure API key is available."""
126
104
  return bool(self.api_key or os.environ.get("AZURE_API_KEY"))
127
105
 
106
+ @staticmethod
107
+ def _get_azure_ad_token_provider() -> Callable[[], str] | None:
108
+ """Get Azure AD token provider for Entra ID authentication.
109
+
110
+ Uses LiteLLM's built-in helper which leverages DefaultAzureCredential:
111
+ - Azure CLI credentials (az login)
112
+ - Managed Identity
113
+ - Environment variables (AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, ...)
114
+ - Visual Studio Code credentials
115
+ """
116
+ try:
117
+ from litellm.secret_managers.get_azure_ad_token_provider import (
118
+ get_azure_ad_token_provider,
119
+ )
120
+
121
+ return get_azure_ad_token_provider()
122
+ except ImportError:
123
+ # azure-identity not installed
124
+ return None
125
+ except Exception:
126
+ # Credential not available
127
+ return None
128
+
128
129
  @property
129
130
  def system_prompt(self) -> str:
130
131
  """Get the system prompt used for LLM assertions."""
@@ -1561,7 +1561,7 @@ wheels = [
1561
1561
 
1562
1562
  [[package]]
1563
1563
  name = "pytest-llm-assert"
1564
- version = "0.1.1"
1564
+ version = "0.2.0"
1565
1565
  source = { editable = "." }
1566
1566
  dependencies = [
1567
1567
  { name = "azure-identity" },