-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary of changes: - Added test imports script and updated tox.ini to call it.
- Loading branch information
Ivan Chvets
committed
Sep 28, 2023
1 parent
fb17cf7
commit 27e2ae8
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# This python script tests loading of required modules | ||
# | ||
import tensorflow as tf | ||
import kfp | ||
import kfp_server_api | ||
import kfserving | ||
import bokeh | ||
import cloudpickle | ||
import dill | ||
import ipympl | ||
import ipywidgets | ||
import jupyterlab_git | ||
import matplotlib | ||
import pandas | ||
# TO-DO verify how exactly scikit-image is installed | ||
#import scikit_image | ||
import scikit_learn | ||
import scipy | ||
import seaborn | ||
import xgboost | ||
|
||
# this string is expected by test script | ||
print("PASSED") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
# | ||
# | ||
from pathlib import Path | ||
|
||
import os | ||
import subprocess | ||
import yaml | ||
|
||
|
||
def main(): | ||
"""Test running container and imports.""" | ||
rock = yaml.safe_load(Path("rockcraft.yaml").read_text()) | ||
name = rock["name"] | ||
rock_version = rock["version"] | ||
arch = list(rock["platforms"].keys())[0] | ||
rock_image = f"{name}_{rock_version}_{arch}" | ||
LOCAL_ROCK_IMAGE = f"{rock_image}:{rock_version}" | ||
|
||
print(f"Running command in {LOCAL_ROCK_IMAGE}") | ||
script_command = ["bash", "-c", "export PYTHONPATH=$PYTHONPATH:/opt/conda/lib/python3.8/site-packages/keras/api/keras/wrappers/:/opt/conda/lib/python3.8/site-packages/ && python3 /home/jovyan/imports.py"] | ||
pwd = os.getcwd() | ||
output = subprocess.run(["docker", "run", "-v", f"{pwd}/tests/:/home/jovyan", LOCAL_ROCK_IMAGE, "exec", "pebble", "exec"] + script_command, stdout=subprocess.PIPE).stdout.decode('utf-8') | ||
assert "PASSED" in output | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters