Skip to content

Commit

Permalink
Cleaned up mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmkc committed Apr 30, 2021
1 parent 00102be commit b09cece
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions samples/model-builder/conftest.py
Expand Up @@ -215,7 +215,7 @@ def mock_run_custom_training_job():

@pytest.fixture
def mock_model():
mock = MagicMock(aiplatform.models.Model)
mock = MagicMock(aiplatform.Model)
yield mock


Expand All @@ -231,11 +231,13 @@ def mock_batch_predict_model(mock_model):
with patch.object(mock_model, "batch_predict") as mock:
yield mock


@pytest.fixture
def mock_upload_model():
with patch.object(aiplatform.Model, "upload") as mock:
yield mock


@pytest.fixture
def mock_deploy_model(mock_model, mock_endpoint):
with patch.object(mock_model, "deploy") as mock:
Expand Down Expand Up @@ -265,7 +267,7 @@ def mock_create_batch_prediction_job():

@pytest.fixture
def mock_endpoint():
mock = MagicMock(aiplatform.models.Endpoint)
mock = MagicMock(aiplatform.Endpoint)
yield mock


Expand All @@ -281,8 +283,9 @@ def mock_get_endpoint(mock_endpoint):
mock_get_endpoint.return_value = mock_endpoint
yield mock_get_endpoint


@pytest.fixture
def mock_endpoint_explain(mock_endpoint):
with patch.object(mock_endpoint, "explain") as mock_endpoint_explain:
mock_get_endpoint.return_value = mock_endpoint
yield mock_endpoint_explain
yield mock_endpoint_explain

0 comments on commit b09cece

Please sign in to comment.