Skip to content

Commit 158c00c

Browse files
authored
chore: fix flaky system tests (#84)
* Remove a mutation that could affect subsequent tests. * Make error message from API more flexible. Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent c506200 commit 158c00c

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

tests/system/small/test_pandas_options.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_read_gbq_start_sets_session_location(
7575
# Now read_gbq* from another location should fail
7676
with pytest.raises(
7777
google.api_core.exceptions.NotFound,
78-
match=f"404 Not found: Dataset {dataset_id_permanent} was not found in location {tokyo_location}",
78+
match=dataset_id_permanent,
7979
):
8080
read_method(query)
8181

@@ -100,7 +100,7 @@ def test_read_gbq_start_sets_session_location(
100100
# Now read_gbq* from another location should fail
101101
with pytest.raises(
102102
google.api_core.exceptions.NotFound,
103-
match=f"404 Not found: Dataset {dataset_id_permanent_tokyo} was not found in location US",
103+
match=dataset_id_permanent_tokyo,
104104
):
105105
read_method(query_tokyo)
106106

@@ -146,7 +146,7 @@ def test_read_gbq_after_session_start_must_comply_with_default_location(
146146
# Doing read_gbq* from a table in another location should fail
147147
with pytest.raises(
148148
google.api_core.exceptions.NotFound,
149-
match=f"404 Not found: Dataset {dataset_id_permanent_tokyo} was not found in location US",
149+
match=dataset_id_permanent_tokyo,
150150
):
151151
read_method(query_tokyo)
152152

@@ -194,7 +194,7 @@ def test_read_gbq_must_comply_with_set_location_US(
194194
# Starting user journey with read_gbq* from another location should fail
195195
with pytest.raises(
196196
google.api_core.exceptions.NotFound,
197-
match=f"404 Not found: Dataset {dataset_id_permanent_tokyo} was not found in location US",
197+
match=dataset_id_permanent_tokyo,
198198
):
199199
read_method(query_tokyo)
200200

@@ -244,7 +244,7 @@ def test_read_gbq_must_comply_with_set_location_non_US(
244244
# Starting user journey with read_gbq* from another location should fail
245245
with pytest.raises(
246246
google.api_core.exceptions.NotFound,
247-
match=f"404 Not found: Dataset {dataset_id_permanent} was not found in location {tokyo_location}",
247+
match=dataset_id_permanent,
248248
):
249249
read_method(query)
250250

tests/system/small/test_session.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,10 @@ def test_read_pandas_multi_index(session, scalars_pandas_df_multi_index):
321321

322322

323323
def test_read_pandas_rowid_exists_adds_suffix(session, scalars_pandas_df_default_index):
324-
scalars_pandas_df_default_index["rowid"] = np.arange(
325-
scalars_pandas_df_default_index.shape[0]
326-
)
324+
pandas_df = scalars_pandas_df_default_index.copy()
325+
pandas_df["rowid"] = np.arange(pandas_df.shape[0])
327326

328-
df = session.read_pandas(scalars_pandas_df_default_index)
327+
df = session.read_pandas(pandas_df)
329328
total_order_col = df._block._expr._ordering.total_order_col
330329
assert total_order_col and total_order_col.column_id == "rowid_2"
331330

0 commit comments

Comments
 (0)