diff --git a/conda-store-server/conda_store_server/_internal/schema.py b/conda-store-server/conda_store_server/_internal/schema.py index fc9cef593..e068dcea2 100644 --- a/conda-store-server/conda_store_server/_internal/schema.py +++ b/conda-store-server/conda_store_server/_internal/schema.py @@ -147,7 +147,8 @@ class Specification(BaseModel): model_config = ConfigDict(from_attributes=True) -class BuildArtifactType(enum.Enum): +# Use str mixin to allow pydantic to serialize Settings models +class BuildArtifactType(str, enum.Enum): DIRECTORY = "DIRECTORY" LOCKFILE = "LOCKFILE" LOGS = "LOGS" @@ -364,8 +365,6 @@ class Settings(BaseModel): metadata={"global": False}, ) - model_config = ConfigDict(use_enum_values=True) - PipArg = Annotated[str, AfterValidator(lambda v: check_pip(v))] diff --git a/conda-store-server/tests/test_app.py b/conda-store-server/tests/test_app.py index 99e24d6f5..04b617a8d 100644 --- a/conda-store-server/tests/test_app.py +++ b/conda-store-server/tests/test_app.py @@ -56,7 +56,7 @@ def test_conda_store_register_environment_workflow( build = api.get_build(db, build_id=build_id) assert build is not None - assert build.status == schema.BuildStatus.QUEUED + assert build.status in [schema.BuildStatus.QUEUED, schema.BuildStatus.COMPLETED] assert build.environment.name == simple_specification.name assert build.environment.namespace.name == namespace_name assert build.specification.spec["name"] == simple_specification.name