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
3 changes: 2 additions & 1 deletion requirements/extras/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
tox==3.24.5
setuptools<72.0.0
numpy>=2.0.0, <3.0
build[virtualenv]==1.2.1
flake8==7.1.2
pytest==6.2.5
pytest-cov==3.0.0
pytest-rerunfailures==10.2
pytest-rerunfailures<14.0,>=11.0
pytest-timeout==2.1.0
pytest-xdist==2.4.0
coverage>=5.2, <6.2
Expand Down
3 changes: 2 additions & 1 deletion tests/data/multimodel/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
RUN update-alternatives --install /usr/local/bin/pip pip /usr/local/bin/pip3 1

# Install MXNet, MMS, and SageMaker Inference Toolkit to set up MMS
RUN pip3 --no-cache-dir install mxnet \
RUN pip3 --no-cache-dir install 'setuptools<72.0.0' \
mxnet \
multi-model-server \
sagemaker-inference \
retrying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@

@pytest.fixture
def sagemaker_session_mock():
return Mock()
mock = Mock()
mock.sagemaker_config = None
return mock


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/sagemaker/feature_store/test_feature_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def s3_uri():
@pytest.fixture
def sagemaker_session_mock():
sagemaker_session_mock = Mock()
sagemaker_session_mock.sagemaker_config = {}
sagemaker_session_mock.sagemaker_config = None
return sagemaker_session_mock


Expand Down
4 changes: 3 additions & 1 deletion tests/unit/sagemaker/feature_store/test_feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

@pytest.fixture
def sagemaker_session_mock():
return Mock()
mock = Mock()
mock.sagemaker_config = None
return mock


@pytest.fixture
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/sagemaker/feature_store/test_feature_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def __reduce__(self):
@pytest.fixture
def sagemaker_session_mock():
"""Fixture Mock class"""
return Mock()
mock = Mock()
mock.sagemaker_config = None
return mock


def test_convert_unsupported_types_to_supported(sagemaker_session_mock):
Expand Down
21 changes: 18 additions & 3 deletions tests/unit/sagemaker/lineage/test_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,12 @@ def test_create_delete_with_association(sagemaker_session):
)


def test_downstream_trials(sagemaker_session):
@unittest.mock.patch("sagemaker.lineage.artifact.get_module")
def test_downstream_trials(mock_get_module, sagemaker_session):
# Mock smexperiments module
mock_smexperiments = unittest.mock.MagicMock()
mock_get_module.return_value = mock_smexperiments

sagemaker_session.sagemaker_client.list_associations.side_effect = [
{
"AssociationSummaries": [
Expand Down Expand Up @@ -379,7 +384,12 @@ def test_downstream_trials(sagemaker_session):
assert expected_calls == sagemaker_session.sagemaker_client.list_associations.mock_calls


def test_downstream_trials_v2(sagemaker_session):
@unittest.mock.patch("sagemaker.lineage.artifact.get_module")
def test_downstream_trials_v2(mock_get_module, sagemaker_session):
# Mock smexperiments module
mock_smexperiments = unittest.mock.MagicMock()
mock_get_module.return_value = mock_smexperiments

sagemaker_session.sagemaker_client.query_lineage.return_value = {
"Vertices": [
{"Arn": "B" + str(i), "Type": "DataSet", "LineageType": "Artifact"} for i in range(10)
Expand Down Expand Up @@ -425,7 +435,12 @@ def test_downstream_trials_v2(sagemaker_session):
assert expected_calls == sagemaker_session.sagemaker_client.query_lineage.mock_calls


def test_upstream_trials(sagemaker_session):
@unittest.mock.patch("sagemaker.lineage.artifact.get_module")
def test_upstream_trials(mock_get_module, sagemaker_session):
# Mock smexperiments module
mock_smexperiments = unittest.mock.MagicMock()
mock_get_module.return_value = mock_smexperiments

sagemaker_session.sagemaker_client.query_lineage.return_value = {
"Vertices": [
{"Arn": "B" + str(i), "Type": "DataSet", "LineageType": "Artifact"} for i in range(10)
Expand Down
1 change: 1 addition & 0 deletions tests/unit/sagemaker/workflow/test_callback_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
def sagemaker_session_mock():
session_mock = Mock()
session_mock.boto_session.client = Mock()
session_mock.sagemaker_config = None
return session_mock


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_mxnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import pytest
from mock import MagicMock, Mock, ANY
from mock import patch
from pkg_resources import parse_version
from packaging.version import parse as parse_version

from sagemaker.fw_utils import UploadedCode
from sagemaker.drift_check_baselines import DriftCheckBaselines
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ commands =

pytest {posargs}
deps =
setuptools<72.0.0
.[test]
asyncio
nest_asyncio
Expand Down