Skip to content

Commit 4e55189

Browse files
Fix sagemaker-core unit test and sagemaker-serve integ test (#5509)
* Fix sagemaker-core unit test and sagemaker-serve integ test failure due to new djl images and pandas mock leak
1 parent e706e57 commit 4e55189

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

sagemaker-core/tests/unit/image_uris/test_djl.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ def _test_djl_uris(account, region, version, tag, djl_framework):
8686
# Known missing framework:version:region combinations that don't exist in ECR
8787
KNOWN_MISSING_COMBINATIONS = {
8888
"djl-lmi": {
89+
"0.36.0-lmi18.0.0-cu128": {"ap-east-2"},
90+
"0.35.0-lmi17.0.0-cu128": {"ap-east-2"},
91+
"0.34.0-lmi16.0.0-cu128": {"ap-east-2"},
92+
"0.33.0-lmi15.0.0-cu128": {"ap-east-2"},
93+
"0.32.0-lmi14.0.0-cu126": {"ap-east-2"},
94+
"0.31.0-lmi13.0.0-cu124": {"ap-east-2"},
8995
"0.30.0-lmi12.0.0-cu124": {"ap-east-2"},
9096
"0.29.0-lmi11.0.0-cu124": {"ap-east-2"},
9197
"0.28.0-lmi10.0.0-cu124": {"ap-east-2"},
@@ -205,6 +211,8 @@ def _test_djl_uris(account, region, version, tag, djl_framework):
205211
},
206212
},
207213
"djl-tensorrtllm": {
214+
"0.33.0-tensorrtllm0.21.0-cu128": {"ap-east-2"},
215+
"0.32.0-tensorrtllm0.12.0-cu125": {"ap-east-2"},
208216
"0.30.0-tensorrtllm0.12.0-cu125": {"ap-east-2"},
209217
"0.29.0-tensorrtllm0.11.0-cu124": {"ap-east-2"},
210218
"0.28.0-tensorrtllm0.9.0-cu122": {"ap-east-2"},

sagemaker-core/tests/unit/test_analytics.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@
1717
import pytest
1818
from unittest.mock import Mock, patch, MagicMock, mock_open
1919
from collections import OrderedDict
20-
21-
# Mock pandas before importing analytics
2220
import sys
2321

24-
sys.modules["pandas"] = MagicMock()
25-
2622
from sagemaker.core.analytics import (
2723
AnalyticsMetricsBase,
2824
HyperparameterTuningJobAnalytics,
@@ -33,6 +29,19 @@
3329
)
3430

3531

32+
@pytest.fixture(autouse=True)
33+
def mock_pandas_for_analytics():
34+
"""Mock pandas for analytics tests only, with proper cleanup."""
35+
original_pandas = sys.modules.get("pandas")
36+
sys.modules["pandas"] = MagicMock()
37+
yield
38+
# Restore original pandas after each test
39+
if original_pandas is not None:
40+
sys.modules["pandas"] = original_pandas
41+
elif "pandas" in sys.modules:
42+
del sys.modules["pandas"]
43+
44+
3645
class TestAnalyticsMetricsBase:
3746
"""Test AnalyticsMetricsBase abstract class."""
3847

sagemaker-serve/tests/integ/test_huggingface_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
logger = logging.getLogger(__name__)
2626

2727
# Configuration - easily customizable
28-
MODEL_ID = "t5-small" # Small text generation model
28+
MODEL_ID = "gpt2" # Small causal language model compatible with DJL 0.36.0 vLLM
2929
MODEL_NAME_PREFIX = "hf-test-model"
3030
ENDPOINT_NAME_PREFIX = "hf-test-endpoint"
3131

0 commit comments

Comments
 (0)