File tree 3 files changed +13
-5
lines changed
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- from unittest .mock import MagicMock , patch
15
+ from unittest .mock import MagicMock
16
+ from unittest .mock import patch
16
17
17
18
from google .cloud import aiplatform
19
+ import vertexai
18
20
from vertexai .resources import preview as preview_resources
19
21
import pytest
20
22
@@ -25,6 +27,12 @@ def mock_sdk_init():
25
27
yield mock
26
28
27
29
30
+ @pytest .fixture
31
+ def mock_vertexai_init ():
32
+ with patch .object (vertexai , "init" ) as mock :
33
+ yield mock
34
+
35
+
28
36
"""
29
37
----------------------------------------------------------------------------
30
38
Dataset Fixtures
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ def init_sample(
28
28
service_account : Optional [str ] = None ,
29
29
):
30
30
31
- from google . cloud import aiplatform
31
+ import vertexai
32
32
33
- aiplatform .init (
33
+ vertexai .init (
34
34
project = project ,
35
35
location = location ,
36
36
experiment = experiment ,
Original file line number Diff line number Diff line change 17
17
import test_constants as constants
18
18
19
19
20
- def test_init_sample (mock_sdk_init ):
20
+ def test_init_sample (mock_vertexai_init ):
21
21
22
22
init_sample .init_sample (
23
23
project = constants .PROJECT ,
@@ -29,7 +29,7 @@ def test_init_sample(mock_sdk_init):
29
29
service_account = constants .SERVICE_ACCOUNT ,
30
30
)
31
31
32
- mock_sdk_init .assert_called_once_with (
32
+ mock_vertexai_init .assert_called_once_with (
33
33
project = constants .PROJECT ,
34
34
location = constants .LOCATION_EUROPE ,
35
35
experiment = constants .EXPERIMENT_NAME ,
You can’t perform that action at this time.
0 commit comments