File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- from unittest .mock import MagicMock , patch
15+ from unittest .mock import MagicMock
16+ from unittest .mock import patch
1617
1718from google .cloud import aiplatform
19+ import vertexai
1820from vertexai .resources import preview as preview_resources
1921import pytest
2022
@@ -25,6 +27,12 @@ def mock_sdk_init():
2527 yield mock
2628
2729
30+ @pytest .fixture
31+ def mock_vertexai_init ():
32+ with patch .object (vertexai , "init" ) as mock :
33+ yield mock
34+
35+
2836"""
2937----------------------------------------------------------------------------
3038Dataset Fixtures
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ def init_sample(
2828 service_account : Optional [str ] = None ,
2929):
3030
31- from google . cloud import aiplatform
31+ import vertexai
3232
33- aiplatform .init (
33+ vertexai .init (
3434 project = project ,
3535 location = location ,
3636 experiment = experiment ,
Original file line number Diff line number Diff line change 1717import test_constants as constants
1818
1919
20- def test_init_sample (mock_sdk_init ):
20+ def test_init_sample (mock_vertexai_init ):
2121
2222 init_sample .init_sample (
2323 project = constants .PROJECT ,
@@ -29,7 +29,7 @@ def test_init_sample(mock_sdk_init):
2929 service_account = constants .SERVICE_ACCOUNT ,
3030 )
3131
32- mock_sdk_init .assert_called_once_with (
32+ mock_vertexai_init .assert_called_once_with (
3333 project = constants .PROJECT ,
3434 location = constants .LOCATION_EUROPE ,
3535 experiment = constants .EXPERIMENT_NAME ,
You can’t perform that action at this time.
0 commit comments