Skip to content

Commit

Permalink
[BUG]: Added allow_reuse=True to pydantic validators (#1054)
Browse files Browse the repository at this point in the history
Note: Cross-version testing was failing as it was loading config twice
which caused the issue with pydantic.

## Description of changes

*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
- Fixing `chromadb/test/property/test_cross_version_persist.py` test
failures.

## Test plan
*How are these changes tested?*

- [x] Tests pass locally with `pytest` for python

## Documentation Changes
No docs need updating
  • Loading branch information
tazarov authored Aug 28, 2023
1 parent f71f1d6 commit bd6250c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions chromadb/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Settings(BaseSettings): # type: ignore

chroma_server_auth_provider: Optional[str] = None

@validator("chroma_server_auth_provider", pre=True, always=True)
@validator("chroma_server_auth_provider", pre=True, always=True, allow_reuse=True)
def chroma_server_auth_provider_non_empty(
cls: Type["Settings"], v: str
) -> Optional[str]:
Expand All @@ -109,7 +109,9 @@ def chroma_server_auth_provider_non_empty(
chroma_server_auth_credentials_file: Optional[str] = None
chroma_server_auth_credentials: Optional[str] = None

@validator("chroma_server_auth_credentials_file", pre=True, always=True)
@validator(
"chroma_server_auth_credentials_file", pre=True, always=True, allow_reuse=True
)
def chroma_server_auth_credentials_file_non_empty_file_exists(
cls: Type["Settings"], v: str
) -> Optional[str]:
Expand Down

0 comments on commit bd6250c

Please sign in to comment.