Skip to content
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

Add first Model Registry tests #54

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,6 @@ cython_debug/
# OS generated files #
.DS_Store
.DS_Store?

# VSCode config
.vscode/
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,3 @@ pre-commit install

- Add typing to new code; typing is enforced using [mypy](https://mypy-lang.org/)
- Rules are defined in [our pyproject.toml file](//pyproject.toml#L10)

If you use Visual Studio Code as your IDE, we recommend using the [Mypy Type Checker](https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker) extension.
After installing it, make sure to update the `Mypy-type-checkers: Args` setting
to `"mypy-type-checker.args" = ["--config-file=pyproject.toml"]`.
35 changes: 35 additions & 0 deletions VSCODE_CONFIG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Helpful VS Code Settings and Extensions

The following are some helpful tips on how to set up your VS Code environment for working with this repository.

## Mypy Type Checker in Visual Studio Code

If you use Visual Studio Code as your IDE, we recommend using the [Mypy Type Checker](https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker) extension.
After installing it, make sure to update the `Mypy-type-checkers: Args` setting
to `"mypy-type-checker.args" = ["--config-file=pyproject.toml"]`.

## Debugging in Visual Studio Code

If you use Visual Studio Code and want to debug your test execution with its "Run and Debug" feature, you'll want to use
a `launch.json` file similar to this one:

```
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"justMyCode": false, #set to false if you want to debug dependent libraries too
"name": "uv_pytest_debugger",
"type": "debugpy",
"request": "launch",
"program": ".venv/bin/pytest", #or your path to pytest's bin in the venv
"python": "${command:python.interpreterPath}", #make sure uv's python interpreter is selected in vscode
"console": "integratedTerminal",
"args": "path/to/test.py" #the args for pytest, can be a list, in this example runs a single file
}
]
}
```
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ classifiers = [
dependencies = [
"ipython>=8.18.1",
"openshift-python-utilities>=5.0.71",
"openshift-python-wrapper>=11.0.6",
"openshift-python-wrapper>=11.0.7",
"pytest-dependency>=0.6.0",
"pytest-progress",
"python-simple-logger",
"pyyaml",
"tenacity",
"types-requests>=2.32.0.20241016",
"schemathesis>=3.38.10",
"requests",
"pytest-asyncio",
"syrupy",
Expand Down
10 changes: 9 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Tuple, Any, Generator

import shlex
import pytest
from pytest import FixtureRequest, Config
from kubernetes.dynamic import DynamicClient
from ocp_resources.namespace import Namespace
from ocp_resources.resource import get_client
from pyhelper_utils.shell import run_command

from utilities.infra import create_ns
from utilities.constants import AcceleratorType
Expand All @@ -15,6 +16,13 @@ def admin_client() -> DynamicClient:
return get_client()


@pytest.fixture(scope="session")
lugi0 marked this conversation as resolved.
Show resolved Hide resolved
def current_client_token(admin_client: DynamicClient) -> str:
_, out, _ = run_command(command=shlex.split("oc whoami -t"), verify_stderr=False, check=False)
lugi0 marked this conversation as resolved.
Show resolved Hide resolved
# `\n` appended to token in out, return without that
return out.strip()


@pytest.fixture(scope="class")
def model_namespace(request: FixtureRequest, admin_client: DynamicClient) -> Generator[Namespace, Any, Any]:
with create_ns(admin_client=admin_client, name=request.param["name"]) as ns:
Expand Down
Empty file.
Loading