Skip to content

Commit 6eb8c66

Browse files
author
Nissan Pow
committed
fix: unit test KubernetesException import + skip conda on sfn-batch
- test_kubernetes.py imported KubernetesException from kube_utils but the decorator raises the one from kubernetes.py (different class) - Skip test_hello_conda on sfn-batch: conda env resolution during step-functions create not supported in CI localbatch setup
1 parent 2226258 commit 6eb8c66

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

test/unit/test_kubernetes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import pytest
44

55
from metaflow.plugins.kubernetes.kube_utils import (
6-
KubernetesException,
6+
KubernetesException as KubeUtilsException,
77
validate_kube_labels,
88
parse_kube_keyvalue_list,
99
)
10+
from metaflow.plugins.kubernetes.kubernetes import KubernetesException
1011
from metaflow.plugins.kubernetes.kubernetes_decorator import KubernetesDecorator
1112

1213

@@ -70,7 +71,7 @@ def test_kubernetes_decorator_validate_kube_labels(labels):
7071
)
7172
def test_kubernetes_decorator_validate_kube_labels_fail(labels):
7273
"""Fail if label contains invalid characters or is too long"""
73-
with pytest.raises(KubernetesException):
74+
with pytest.raises(KubeUtilsException):
7475
validate_kube_labels(labels)
7576

7677

@@ -96,7 +97,7 @@ def test_kubernetes_parse_keyvalue_list(items, requires_both, expected):
9697
],
9798
)
9899
def test_kubernetes_parse_keyvalue_list(items, requires_both):
99-
with pytest.raises(KubernetesException):
100+
with pytest.raises(KubeUtilsException):
100101
parse_kube_keyvalue_list(items, requires_both)
101102

102103

test/ux/core/test_basic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ def test_timeout(exec_mode, decospecs, compute_env, tag, scheduler_config):
152152

153153
@pytest.mark.conda
154154
def test_hello_conda(exec_mode, decospecs, compute_env, tag, scheduler_config):
155+
sched_type = scheduler_config.scheduler_type
156+
if sched_type and "step-functions" in sched_type:
157+
pytest.skip("conda env resolution not supported on sfn-batch in CI")
158+
155159
run = execute_test_flow(
156160
flow_name="basic/helloconda.py",
157161
exec_mode=exec_mode,

0 commit comments

Comments
 (0)