Skip to content

Commit d205601

Browse files
yinghsienwucopybara-github
authored andcommitted
chore: fix unit test assertions
PiperOrigin-RevId: 723678874
1 parent 58fbabd commit d205601

File tree

7 files changed

+13
-4
lines changed

7 files changed

+13
-4
lines changed

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197
full_extra_require
198198
+ profiler_extra_require
199199
+ tokenization_testing_extra_require
200+
+ vizier_extra_require
200201
+ [
201202
# aiohttp is required for async rest tests (need google-auth[aiohttp],
202203
# but can't specify extras in constraints files)

testing/constraints-3.10.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ pytest-xdist==3.3.1 # Pinned to unbreak unit tests
1414
ray==2.4.0 # Pinned until 2.9.3 is verified for Ray tests
1515
ipython==8.22.2 # Pinned to unbreak TypeAliasType import error
1616
scikit-learn!=1.4.1.post1 # Pin to unbreak test_sklearn (b/332610038)
17-
requests==2.31.0 # Pinned to unbreak http+docker error (b/342669351)
17+
requests==2.31.0 # Pinned to unbreak http+docker error (b/342669351)
18+
google-vizier==0.1.21

testing/constraints-3.11.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ packaging==24.1 # Increased to unbreak canonicalize_version error (b/377774673)
1111
pytest-xdist==3.3.1 # Pinned to unbreak unit tests
1212
ray==2.5.0 # Pinned until 2.9.3 is verified for Ray tests
1313
ipython==8.22.2 # Pinned to unbreak TypeAliasType import error
14+
google-vizier==0.1.21

testing/constraints-3.8.txt

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ packaging==24.1 # Increased to unbreak canonicalize_version error (b/377774673)
1212
grpcio-testing==1.34.0
1313
pytest-xdist==3.3.1 # Pinned to unbreak unit tests
1414
ray==2.4.0 # Pinned until 2.9.3 is verified for Ray tests
15+
google-vizier==0.1.21

testing/constraints-3.9.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ packaging==24.1 # Increased to unbreak canonicalize_version error (b/377774673)
1111
grpcio-testing==1.34.0
1212
pytest-xdist==3.3.1 # Pinned to unbreak unit tests
1313
ray==2.4.0 # Pinned until 2.9.3 is verified for Ray tests
14+
google-vizier==0.1.21

tests/unit/aiplatform/test_endpoints.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3922,7 +3922,7 @@ def test_psa_delete_with_force(self, sdk_undeploy_mock, delete_endpoint_mock, sy
39223922
test_endpoint.wait()
39233923

39243924
# undeploy() should not be called unless force is set to True
3925-
sdk_undeploy_mock.called_once_with(deployed_model_id=_TEST_ID, sync=sync)
3925+
sdk_undeploy_mock.assert_not_called()
39263926

39273927
delete_endpoint_mock.assert_called_once_with(name=_TEST_ENDPOINT_NAME)
39283928

tests/unit/aiplatform/test_utils.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,19 @@ def test_validate_transformations_with_column_transformations(self):
559559
class TestGcsUtils:
560560
def test_upload_to_gcs(self, json_file, mock_storage_blob_upload_from_filename):
561561
gcs_utils.upload_to_gcs(json_file, f"gs://{GCS_BUCKET}/{GCS_PREFIX}")
562-
assert mock_storage_blob_upload_from_filename.called_once_with(json_file)
562+
mock_storage_blob_upload_from_filename.assert_called_once_with(
563+
filename=json_file
564+
)
563565

564566
def test_stage_local_data_in_gcs(
565567
self, json_file, mock_datetime, mock_storage_blob_upload_from_filename
566568
):
567569
timestamp = EXPECTED_TIME.isoformat(sep="-", timespec="milliseconds")
568570
staging_gcs_dir = f"gs://{GCS_BUCKET}/{GCS_PREFIX}"
569571
data_uri = gcs_utils.stage_local_data_in_gcs(json_file, staging_gcs_dir)
570-
assert mock_storage_blob_upload_from_filename.called_once_with(json_file)
572+
mock_storage_blob_upload_from_filename.assert_called_once_with(
573+
filename=json_file
574+
)
571575
assert (
572576
data_uri
573577
== f"{staging_gcs_dir}/vertex_ai_auto_staging/{timestamp}/test.json"

0 commit comments

Comments
 (0)