update to statefulapi calls due to latest changes in schemathesis version#333
Conversation
|
Caution Review failedThe pull request is closed. """ WalkthroughA new Changes
Sequence Diagram(s)sequenceDiagram
participant Pytest
participant Fixture as generated_schema
participant Env as Environment
participant Schemathesis
Pytest->>Fixture: Call generated_schema(pytestconfig, model_registry_instance_rest_endpoint)
Fixture->>Env: Set API_HOST = model_registry_instance_rest_endpoint
Fixture->>Schemathesis: Load OpenAPI schema (from schemathesis.toml config)
Schemathesis-->>Fixture: Return schema
Fixture-->>Pytest: Return schema
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The following are automatically added/executed:
Available user actions:
Supported labels{'/wip', '/lgtm', '/hold', '/verified'} |
|
/build-push-pr-image |
|
Status of building tag pr-333: success. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/model_registry/conftest.py (1)
264-270: Approve the configuration approach but address code quality issues.The updated fixture correctly implements the new schemathesis configuration pattern using external TOML config and environment variables. However, there are several code quality issues to address:
Apply this diff to improve code quality:
-def generated_schema(pytestconfig: Config, model_registry_instance_rest_endpoint: str) -> BaseOpenAPISchema: +def generated_schema( + pytestconfig: Config, + model_registry_rest_endpoint: str +) -> BaseOpenAPISchema: + """Generate OpenAPI schema with dynamic base URL configuration. + + Args: + pytestconfig: Pytest configuration object + model_registry_rest_endpoint: REST endpoint for model registry + + Returns: + BaseOpenAPISchema: Configured OpenAPI schema + """ - os.environ["API_HOST"] = model_registry_instance_rest_endpoint + os.environ["API_HOST"] = model_registry_rest_endpoint schema = schemathesis.openapi.from_url( - url="https://raw.githubusercontent.com/kubeflow/model-registry/main/api/openapi/model-registry.yaml", - config=schemathesis.config.SchemathesisConfig.from_path(f"{pytestconfig.rootpath}/schemathesis.toml"), + url="https://raw.githubusercontent.com/kubeflow/model-registry/" + "main/api/openapi/model-registry.yaml", + config=schemathesis.config.SchemathesisConfig.from_path( + f"{pytestconfig.rootpath}/schemathesis.toml" + ), ) return schemaThis addresses:
- Line length violations (C0301)
- Missing docstring (C0116)
- Parameter name shadowing (W0621)
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 264-264: Line too long (108/100)
(C0301)
[convention] 267-267: Line too long (109/100)
(C0301)
[convention] 268-268: Line too long (110/100)
(C0301)
[convention] 264-264: Missing function or method docstring
(C0116)
[warning] 264-264: Redefining name 'model_registry_instance_rest_endpoint' from outer scope (line 250)
(W0621)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
schemathesis.toml(1 hunks)tests/model_registry/conftest.py(2 hunks)
🧰 Additional context used
🪛 Pylint (3.3.7)
tests/model_registry/conftest.py
[convention] 1-1: Missing module docstring
(C0114)
[convention] 264-264: Line too long (108/100)
(C0301)
[convention] 267-267: Line too long (109/100)
(C0301)
[convention] 268-268: Line too long (110/100)
(C0301)
[convention] 264-264: Missing function or method docstring
(C0116)
[warning] 264-264: Redefining name 'model_registry_instance_rest_endpoint' from outer scope (line 250)
(W0621)
🔇 Additional comments (2)
schemathesis.toml (1)
1-1: LGTM! Clean configuration approach.The TOML configuration file correctly uses environment variable substitution to dynamically set the API base URL. This approach aligns with schemathesis best practices for external configuration management.
tests/model_registry/conftest.py (1)
1-3: LGTM! Necessary imports for the new configuration approach.The added imports (
osandConfig) are required for the updated fixture implementation that uses environment variables and external configuration.🧰 Tools
🪛 Pylint (3.3.7)
[convention] 1-1: Missing module docstring
(C0114)
|
Status of building tag latest: success. |
Description
How Has This Been Tested?
Merge criteria:
Summary by CodeRabbit