Skip to content

chore: Shift tests to default to partial ordering #1430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions tests/system/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,8 @@ def resourcemanager_client(


@pytest.fixture(scope="session")
def session() -> Generator[bigframes.Session, None, None]:
context = bigframes.BigQueryOptions(
location="US",
)
session = bigframes.Session(context=context)
yield session
session.close() # close generated session at cleanup time
def session(unordered_session) -> Generator[bigframes.Session, None, None]:
return unordered_session


@pytest.fixture(scope="session")
Expand All @@ -163,6 +158,14 @@ def maybe_ordered_session(request) -> Generator[bigframes.Session, None, None]:
session.close() # close generated session at cleanup type


@pytest.fixture(scope="session")
def ordered_session() -> Generator[bigframes.Session, None, None]:
context = bigframes.BigQueryOptions(location="US", ordering_mode="strict")
session = bigframes.Session(context=context)
yield session
session.close() # close generated session at cleanup type


@pytest.fixture(scope="session")
def unordered_session() -> Generator[bigframes.Session, None, None]:
context = bigframes.BigQueryOptions(location="US", ordering_mode="partial")
Expand Down Expand Up @@ -431,7 +434,7 @@ def nested_df(
nested_table_id: str, session: bigframes.Session
) -> bigframes.dataframe.DataFrame:
"""DataFrame pointing at test data."""
return session.read_gbq(nested_table_id, index_col="rowindex")
return session.read_gbq(nested_table_id, index_col="rowindex").sort_index()


@pytest.fixture(scope="session")
Expand All @@ -451,7 +454,7 @@ def nested_structs_df(
nested_structs_table_id: str, session: bigframes.Session
) -> bigframes.dataframe.DataFrame:
"""DataFrame pointing at test data."""
return session.read_gbq(nested_structs_table_id, index_col="id")
return session.read_gbq(nested_structs_table_id, index_col="id").sort_index()


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -508,7 +511,7 @@ def json_df(
json_table_id: str, session: bigframes.Session
) -> bigframes.dataframe.DataFrame:
"""Returns a DataFrame containing columns of JSON type."""
return session.read_gbq(json_table_id, index_col="rowindex")
return session.read_gbq(json_table_id, index_col="rowindex").sort_index()


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -541,7 +544,7 @@ def scalars_df_index(
scalars_table_id: str, session: bigframes.Session
) -> bigframes.dataframe.DataFrame:
"""DataFrame pointing at test data."""
return session.read_gbq(scalars_table_id, index_col="rowindex")
return session.read_gbq(scalars_table_id, index_col="rowindex").sort_index()


@pytest.fixture(scope="session")
Expand All @@ -567,7 +570,7 @@ def scalars_df_2_index(
scalars_table_id_2: str, session: bigframes.Session
) -> bigframes.dataframe.DataFrame:
"""DataFrame pointing at test data."""
return session.read_gbq(scalars_table_id_2, index_col="rowindex")
return session.read_gbq(scalars_table_id_2, index_col="rowindex").sort_index()


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -753,7 +756,7 @@ def time_series_df_default_index(
time_series_table_id: str, session: bigframes.Session
) -> bigframes.dataframe.DataFrame:
"""DataFrame pointing at test data."""
return session.read_gbq(time_series_table_id)
return session.read_gbq(time_series_table_id).sort_values("parsed_date")


@pytest.fixture(scope="session")
Expand Down