Skip to content

Commit b3db519

Browse files
chore: Move remaining test utils to bigframes.testing module (#1810)
Co-authored-by: Shenyang Cai <[email protected]>
1 parent 18f43e8 commit b3db519

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+62
-68
lines changed
File renamed without changes.

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
doctest_optionflags = NORMALIZE_WHITESPACE
33
filterwarnings =
44
ignore::pandas.errors.SettingWithCopyWarning
5+
addopts = "--import-mode=importlib"

scripts/__init__.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

scripts/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pathlib import Path
2+
import sys
3+
4+
# inserts scripts into path so that tests can import
5+
project_root = Path(__file__).parent.parent
6+
scripts_dir = project_root / "scripts"
7+
8+
sys.path.insert(0, str(scripts_dir))

scripts/test_publish_api_coverage.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515
import sys
1616

1717
import pandas
18+
from publish_api_coverage import build_api_coverage_table
1819
import pytest
1920

20-
from . import publish_api_coverage
21-
2221
pytest.importorskip("sklearn")
2322

2423

2524
@pytest.fixture
2625
def api_coverage_df():
27-
return publish_api_coverage.build_api_coverage_table("my_bf_ver", "my_release_ver")
26+
return build_api_coverage_table("my_bf_ver", "my_release_ver")
2827

2928

3029
@pytest.mark.skipif(

tests/system/conftest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import bigframes.dataframe
4242
import bigframes.pandas as bpd
4343
import bigframes.series
44-
import tests.system.utils
44+
import bigframes.testing.utils
4545

4646
# Use this to control the number of cloud functions being deleted in a single
4747
# test session. This should help soften the spike of the number of mutations per
@@ -615,7 +615,7 @@ def scalars_pandas_df_default_index() -> pd.DataFrame:
615615
DATA_DIR / "scalars.jsonl",
616616
lines=True,
617617
)
618-
tests.system.utils.convert_pandas_dtypes(df, bytes_col=True)
618+
bigframes.testing.utils.convert_pandas_dtypes(df, bytes_col=True)
619619

620620
df = df.set_index("rowindex", drop=False)
621621
df.index.name = None
@@ -1422,12 +1422,12 @@ def use_fast_query_path():
14221422
@pytest.fixture(scope="session", autouse=True)
14231423
def cleanup_cloud_functions(session, cloudfunctions_client, dataset_id_permanent):
14241424
"""Clean up stale cloud functions."""
1425-
permanent_endpoints = tests.system.utils.get_remote_function_endpoints(
1425+
permanent_endpoints = bigframes.testing.utils.get_remote_function_endpoints(
14261426
session.bqclient, dataset_id_permanent
14271427
)
14281428
delete_count = 0
14291429
try:
1430-
for cloud_function in tests.system.utils.get_cloud_functions(
1430+
for cloud_function in bigframes.testing.utils.get_cloud_functions(
14311431
cloudfunctions_client,
14321432
session.bqclient.project,
14331433
session.bqclient.location,
@@ -1447,7 +1447,7 @@ def cleanup_cloud_functions(session, cloudfunctions_client, dataset_id_permanent
14471447

14481448
# Go ahead and delete
14491449
try:
1450-
tests.system.utils.delete_cloud_function(
1450+
bigframes.testing.utils.delete_cloud_function(
14511451
cloudfunctions_client, cloud_function.name
14521452
)
14531453
delete_count += 1

tests/system/large/functions/test_managed_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import bigframes
2222
import bigframes.exceptions as bfe
2323
import bigframes.pandas as bpd
24-
from tests.system.utils import cleanup_function_assets
24+
from bigframes.testing.utils import cleanup_function_assets
2525

2626
prefixer = test_utils.prefixer.Prefixer("bigframes", "")
2727

tests/system/large/functions/test_remote_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import bigframes.functions._utils as bff_utils
3737
import bigframes.pandas as bpd
3838
import bigframes.series
39-
from tests.system.utils import (
39+
from bigframes.testing.utils import (
4040
assert_pandas_df_equal,
4141
cleanup_function_assets,
4242
delete_cloud_function,

0 commit comments

Comments
 (0)