-
Notifications
You must be signed in to change notification settings - Fork 3
Enable running tests in CI #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments for reviewers
|
||
def __post_init__(self) -> None: | ||
"""Validate required fields and consistency.""" | ||
if "checked_text" not in self.info: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only main code change is this. This validation is not compatible with the current tests. If we think tests should be changed, I am happy to work on it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this line is fine
|
||
model = _resolve_ctx_requirements(check) | ||
fields = getattr(model, "model_fields", getattr(model, "__fields__", {})) | ||
# Prefer Pydantic v2 API without eagerly touching deprecated v1 attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is to resolve warning:
tests/unit/test_registry.py::test_resolve_ctx_protocol_creates_model
/Users/seratch/code/openai-guardrails-python/tests/unit/test_registry.py:40: PydanticDeprecatedSince20: The `__fields__` attribute is deprecated, use `model_fields` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/
fields = getattr(model, "model_fields", getattr(model, "__fields__", {}))
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
Ah, some tests expect OPENAI_API_KEY env variable; I didn't detect it locally. Will fix them too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Code changes are fine
This pull request enables running all the tests in CI.