From 773511829a5c29b48f1e03ef9eb291509e37b2c5 Mon Sep 17 00:00:00 2001 From: Noha Ihab <49988746+NohaIhab@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:41:57 +0300 Subject: [PATCH] fix: skip `test_kubeflow_workloads` when `test_create_profile` fails (#122) * use pytest-dependency plugin --- driver/test_kubeflow_workloads.py | 9 +++++++-- requirements.in | 1 + requirements.txt | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/driver/test_kubeflow_workloads.py b/driver/test_kubeflow_workloads.py index 91a7845..68d9e71 100644 --- a/driver/test_kubeflow_workloads.py +++ b/driver/test_kubeflow_workloads.py @@ -134,7 +134,7 @@ def create_poddefaults_on_proxy(request, lightkube_client): lightkube_client.delete(PODDEFAULT_RESOURCE, name=poddefault_name, namespace=NAMESPACE) -@pytest.mark.abort_on_fail +@pytest.mark.dependency() async def test_create_profile(lightkube_client, create_profile): """Test Profile creation. @@ -174,8 +174,13 @@ async def test_create_profile(lightkube_client, create_profile): log.info(f"PodDefaults in {NAMESPACE} namespace are {created_poddefaults_names}.") +@pytest.mark.dependency(depends=["test_create_profile"]) def test_kubeflow_workloads( - lightkube_client, pytest_cmd, tests_checked_out_commit, request, create_poddefaults_on_proxy + lightkube_client, + pytest_cmd, + tests_checked_out_commit, + request, + create_poddefaults_on_proxy, ): """Run a K8s Job to execute the notebook tests.""" log.info(f"Starting Kubernetes Job {NAMESPACE}/{JOB_NAME} to run notebook tests...") diff --git a/requirements.in b/requirements.in index 33d648b..f78ad17 100644 --- a/requirements.in +++ b/requirements.in @@ -2,4 +2,5 @@ juju<4.0 lightkube pytest pytest-operator +pytest-dependency tenacity diff --git a/requirements.txt b/requirements.txt index ba1d3f8..495ad49 100644 --- a/requirements.txt +++ b/requirements.txt @@ -131,9 +131,12 @@ pytest==7.4.3 # via # -r requirements.in # pytest-asyncio + # pytest-dependency # pytest-operator pytest-asyncio==0.21.1 # via pytest-operator +pytest-dependency==0.6.0 + # via -r requirements.in pytest-operator==0.31.0 # via -r requirements.in python-dateutil==2.8.2 @@ -198,3 +201,6 @@ websocket-client==1.6.4 # via kubernetes websockets==8.1 # via juju + +# The following packages are considered to be unsafe in a requirements file: +# setuptools