Skip to content

Commit 348dae9

Browse files
committed
Fixed tests
1 parent 655b17a commit 348dae9

File tree

5 files changed

+8
-20
lines changed

5 files changed

+8
-20
lines changed

samples/model-builder/conftest.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,14 @@ def mock_model():
218218
mock = MagicMock(aiplatform.models.Model)
219219
yield mock
220220

221+
221222
@pytest.fixture
222-
<<<<<<< HEAD
223-
def mock_get_model(mock_model):
224-
with patch.object(aiplatform, "Model") as mock:
225-
mock.return_value = mock_model
226-
=======
227223
def mock_init_model(mock_model):
228-
<<<<<<< HEAD
229-
with patch.object(aiplatform.models.Model, "__init__") as mock:
230-
mock.return_value = None
231-
>>>>>>> 190388a (Fixed tests)
232-
=======
233224
with patch.object(aiplatform, "Model") as mock:
234225
mock.return_value = mock_model
235-
>>>>>>> 1f2700d (Fixed tests)
236226
yield mock
237227

228+
238229
@pytest.fixture
239230
def mock_batch_predict_model(mock_model):
240231
with patch.object(mock_model, "batch_predict") as mock:

samples/model-builder/create_batch_prediction_job_sample_test.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818

1919

2020
def test_create_batch_prediction_job_sample(
21-
<<<<<<< HEAD
22-
mock_sdk_init, mock_get_model, mock_batch_predict_model
23-
=======
2421
mock_sdk_init, mock_model, mock_init_model, mock_batch_predict_model
25-
>>>>>>> 1f2700d (Fixed tests)
2622
):
2723

2824
create_batch_prediction_job_sample.create_batch_prediction_job_sample(
@@ -37,7 +33,7 @@ def test_create_batch_prediction_job_sample(
3733
mock_sdk_init.assert_called_once_with(
3834
project=constants.PROJECT, location=constants.LOCATION
3935
)
40-
mock_get_model.assert_called_once_with(constants.MODEL_NAME)
36+
mock_init_model.assert_called_once_with(constants.MODEL_NAME)
4137
mock_batch_predict_model.assert_called_once_with(
4238
job_display_name=constants.DISPLAY_NAME,
4339
gcs_source=constants.GCS_SOURCES,

samples/model-builder/deploy_model_with_automatic_resources_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_deploy_model_with_automatic_resources_sample(
3131
traffic_split=constants.TRAFFIC_SPLIT,
3232
min_replica_count=constants.MIN_REPLICA_COUNT,
3333
max_replica_count=constants.MAX_REPLICA_COUNT,
34-
metadata=constants.METADATA,
34+
metadata=constants.ENDPOINT_DEPLOY_METADATA,
3535
)
3636

3737
mock_sdk_init.assert_called_once_with(
@@ -47,6 +47,6 @@ def test_deploy_model_with_automatic_resources_sample(
4747
traffic_split=constants.TRAFFIC_SPLIT,
4848
min_replica_count=constants.MIN_REPLICA_COUNT,
4949
max_replica_count=constants.MAX_REPLICA_COUNT,
50-
metadata=constants.METADATA,
50+
metadata=constants.ENDPOINT_DEPLOY_METADATA,
5151
sync=True,
5252
)

samples/model-builder/deploy_model_with_dedicated_resources_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_deploy_model_with_dedicated_resources_sample(
3636
accelerator_count=constants.ACCELERATOR_COUNT,
3737
explanation_metadata=constants.EXPLANATION_METADATA,
3838
explanation_parameters=constants.EXPLANATION_PARAMETERS,
39-
metadata=constants.METADATA,
39+
metadata=constants.ENDPOINT_DEPLOY_METADATA,
4040
)
4141

4242
mock_sdk_init.assert_called_once_with(
@@ -57,6 +57,6 @@ def test_deploy_model_with_dedicated_resources_sample(
5757
accelerator_count=constants.ACCELERATOR_COUNT,
5858
explanation_metadata=constants.EXPLANATION_METADATA,
5959
explanation_parameters=constants.EXPLANATION_PARAMETERS,
60-
metadata=constants.METADATA,
60+
metadata=constants.ENDPOINT_DEPLOY_METADATA,
6161
sync=True,
6262
)

samples/model-builder/test_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,4 @@
148148
TRAFFIC_SPLIT = {"a": 99, "b": 1}
149149
MIN_REPLICA_COUNT = 1
150150
MAX_REPLICA_COUNT = 1
151+
ENDPOINT_DEPLOY_METADATA = ()

0 commit comments

Comments
 (0)