Skip to content

Commit 804e9e3

Browse files
authored
tests: fix failing e2e tests (#726)
* tests: fix failing e2e tests * remove unnecessary test We already check the VPC is added to the Cloud Function metadata here: https://github.com/googleapis/python-bigquery-dataframes/blob/72e95834f8755760f3529d38f340703f3b971f0a/tests/system/large/test_remote_function.py#L1426
1 parent 72e9583 commit 804e9e3

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

tests/system/large/ml/test_ensemble.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def test_randomforestclassifier_multiple_params(penguins_df_default_index, datas
395395
f"{dataset_id}.temp_configured_randomforestclassifier_model"
396396
in reloaded_model._bqml_model.model_name
397397
)
398-
assert reloaded_model.tree_method == "auto"
398+
assert reloaded_model.tree_method.casefold() == "auto"
399399
assert reloaded_model.colsample_bytree == 0.95
400400
assert reloaded_model.colsample_bylevel == 0.95
401401
assert reloaded_model.colsample_bynode == 0.95

tests/system/large/test_remote_function.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import tempfile
2222
import textwrap
2323

24-
from google.api_core.exceptions import BadRequest, InvalidArgument, NotFound
24+
import google.api_core.exceptions
2525
from google.cloud import bigquery, storage
2626
import pandas
2727
import pytest
@@ -849,7 +849,7 @@ def square(x):
849849
expected_remote_function = f"{dataset_id}.{rf_name}"
850850

851851
# Initially the expected BQ remote function should not exist
852-
with pytest.raises(NotFound):
852+
with pytest.raises(google.api_core.exceptions.NotFound):
853853
session.bqclient.get_routine(expected_remote_function)
854854

855855
# Create the remote function with the name provided explicitly
@@ -981,7 +981,7 @@ def test_internal(rf, udf):
981981
expected_remote_function = f"{dataset_id}.{rf_name}"
982982

983983
# Initially the expected BQ remote function should not exist
984-
with pytest.raises(NotFound):
984+
with pytest.raises(google.api_core.exceptions.NotFound):
985985
session.bqclient.get_routine(expected_remote_function)
986986

987987
# Create a new remote function with the name provided explicitly
@@ -1198,7 +1198,8 @@ def square(x):
11981198
scalars_df, _ = scalars_dfs
11991199

12001200
with pytest.raises(
1201-
BadRequest, match="400.*errorMessage.*unsupported operand type"
1201+
google.api_core.exceptions.BadRequest,
1202+
match="400.*errorMessage.*unsupported operand type",
12021203
):
12031204
# int64_col has nulls which should cause error in square
12041205
scalars_df["int64_col"].apply(square).to_pandas()
@@ -1431,20 +1432,6 @@ def square_num(x):
14311432
)
14321433

14331434

1434-
def test_remote_function_via_session_vpc_invalid(session):
1435-
with pytest.raises(
1436-
InvalidArgument, match="400.*Serverless VPC Access connector is not found"
1437-
):
1438-
1439-
@session.remote_function(
1440-
[int], int, reuse=False, cloud_function_vpc_connector="does-not-exist"
1441-
)
1442-
def square_num(x):
1443-
if x is None:
1444-
return x
1445-
return x * x
1446-
1447-
14481435
@pytest.mark.parametrize(
14491436
("max_batching_rows"),
14501437
[

0 commit comments

Comments
 (0)