From bd6250c934b892fdd7b7449f1b73e450ab334e47 Mon Sep 17 00:00:00 2001 From: Trayan Azarov Date: Tue, 29 Aug 2023 00:34:57 +0300 Subject: [PATCH] [BUG]: Added allow_reuse=True to pydantic validators (#1054) 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 --- chromadb/config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chromadb/config.py b/chromadb/config.py index 67dbfe8ef40..87aa9e7301e 100644 --- a/chromadb/config.py +++ b/chromadb/config.py @@ -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]: @@ -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]: