Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 2 additions & 10 deletions .github/workflows/run-unittests-py38-cov-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,9 @@ jobs:
- uses: ./.github/workflows/set-dummy-conf
name: "Test config setup"

- name: "Test env setup"
- uses: ./.github/workflows/test-env-setup
name: "Test env setup"
timeout-minutes: 20
shell: bash
run: |
set -x # print commands that are executed

sudo apt-get install libkrb5-dev graphviz
$CONDA/bin/conda init
source /home/runner/.bashrc

pip install -r dev-requirements.txt

- name: "Run unitary tests folder with maximum ADS dependencies"
timeout-minutes: 60
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/run-unittests-py39-py310.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,9 @@ jobs:
- uses: ./.github/workflows/set-dummy-conf
name: "Test config setup"

- name: "Test env setup"
- uses: ./.github/workflows/test-env-setup
name: "Test env setup"
timeout-minutes: 20
shell: bash
run: |
set -x # print commands that are executed

sudo apt-get install libkrb5-dev graphviz
$CONDA/bin/conda init
source /home/runner/.bashrc

pip install -r dev-requirements.txt

- name: "Run unitary tests folder with maximum ADS dependencies"
timeout-minutes: 60
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/test-env-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This composite action is to avoid duplicating code across test actions.
# Ref: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

name: "Test env setup"
description: "Creates conda test env with optional dependencies to run all unit tests"
runs:
using: composite
steps:
- shell: bash
run: |
set -x # print commands that are executed

sudo apt update
sudo apt-get install libkrb5-dev graphviz
$CONDA/bin/conda init
source /home/runner/.bashrc

pip install -r dev-requirements.txt
24 changes: 6 additions & 18 deletions tests/unitary/with_extras/model/test_env_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,6 @@ def test_get_service_packs_bad_response():
assert all(slug in slugs for slug, _ in service_pack_slug_mapping.items())


@patch("requests.request", mocked_requests_request)
def test_get_service_packs_cust_tenancy():
service_pack_path_mapping, service_pack_slug_mapping = get_service_packs(
"ociodsccust", "service-conda-packs", None
)
db_pack_path = "oci://service-conda-packs@ociodsccust/service_pack/cpu/Oracle_Database_for_CPU_Python_3.7/1.0/database_p37_cpu_v1"
db_slug = "database_p37_cpu_v1"
db_python_version = "3.7"
assert service_pack_path_mapping[db_pack_path] == (db_slug, db_python_version)
assert service_pack_slug_mapping[db_slug] == (db_pack_path, db_python_version)


class TestTrainingEnvInfo:
"""Test the TrainingEnvInfo class."""

Expand Down Expand Up @@ -181,11 +169,11 @@ def test_from_slug_prod_sp(self):
def test_from_slug_not_exist(self, mock_get_service_packs):
mock_get_service_packs.return_value = (
{
"test_path" : ("mlcpuv1", "3.6"),
"test_path": ("mlcpuv1", "3.6"),
},
{
"mlcpuv1" : ("test_path", "3.6"),
}
"mlcpuv1": ("test_path", "3.6"),
},
)
with pytest.warns(UserWarning, match="not a service pack"):
TrainingEnvInfo.from_slug(
Expand Down Expand Up @@ -269,11 +257,11 @@ def test_from_slug_prod_sp(self):
def test_from_slug_not_exist(self, mock_get_service_packs):
mock_get_service_packs.return_value = (
{
"test_path" : ("mlcpuv1", "3.6"),
"test_path": ("mlcpuv1", "3.6"),
},
{
"mlcpuv1" : ("test_path", "3.6"),
}
"mlcpuv1": ("test_path", "3.6"),
},
)
with pytest.warns(UserWarning, match="not a service pack"):
InferenceEnvInfo.from_slug(
Expand Down
5 changes: 2 additions & 3 deletions tests/unitary/with_extras/opctl/test_opctl_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def test_conda_publish(
mock_run_cmd,
monkeypatch,
):

with tempfile.TemporaryDirectory() as td:
with pytest.raises(FileNotFoundError):
publish(
Expand Down Expand Up @@ -161,7 +160,7 @@ def test_conda_publish(
): {"bind": "/home/datascience/pack.py"},
},
env_vars={},
command="python /home/datascience/pack.py /home/datascience/test",
command="python /home/datascience/pack.py --conda-path /home/datascience/test",
)

mock_uploader.assert_called_with(
Expand All @@ -187,7 +186,7 @@ def test_conda_publish(
import ads

mock_run_cmd.assert_called_with(
f"python {os.path.join(ads.__path__[0], 'opctl', 'conda', 'pack.py')} {os.path.join(td, 'conda', 'test')}",
f"python {os.path.join(ads.__path__[0], 'opctl', 'conda', 'pack.py')} --conda-path {os.path.join(td, 'conda', 'test')}",
shell=True,
)

Expand Down