diff --git a/tests/integ/conftest.py b/tests/integ/conftest.py index 35951897554..b351329fd59 100644 --- a/tests/integ/conftest.py +++ b/tests/integ/conftest.py @@ -14,25 +14,13 @@ from snowflake.snowpark.exceptions import SnowparkSQLException from snowflake.snowpark.mock._connection import MockServerConnection from tests.parameters import CONNECTION_PARAMETERS -from tests.utils import Utils +from tests.utils import Utils, running_on_jenkins, running_on_public_ci -RUNNING_ON_GH = os.getenv("GITHUB_ACTIONS") == "true" -RUNNING_ON_JENKINS = "JENKINS_HOME" in os.environ TEST_SCHEMA = f"GH_JOB_{(str(uuid.uuid4()).replace('-', '_'))}" -if RUNNING_ON_JENKINS: +if running_on_jenkins(): TEST_SCHEMA = f"JENKINS_JOB_{(str(uuid.uuid4()).replace('-', '_'))}" -def running_on_public_ci() -> bool: - """Whether or not tests are currently running on one of our public CIs.""" - return RUNNING_ON_GH - - -def running_on_jenkins() -> bool: - """Whether or not tests are currently running on a Jenkins node.""" - return RUNNING_ON_JENKINS - - def print_help() -> None: print( """Connection parameter must be specified in parameters.py, diff --git a/tests/integ/modin/binary/test_binary_op.py b/tests/integ/modin/binary/test_binary_op.py index f142083dac9..847ca51a76c 100644 --- a/tests/integ/modin/binary/test_binary_op.py +++ b/tests/integ/modin/binary/test_binary_op.py @@ -17,7 +17,6 @@ import snowflake.snowpark.modin.plugin # noqa: F401 from snowflake.snowpark.exceptions import SnowparkSQLException from snowflake.snowpark.modin.pandas.utils import try_convert_index_to_native -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.series.test_bitwise_operators import try_cast_to_snow_series from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import ( @@ -27,6 +26,7 @@ create_test_series, eval_snowpark_pandas_result, ) +from tests.utils import running_on_public_ci @pytest.mark.parametrize( diff --git a/tests/integ/modin/conftest.py b/tests/integ/modin/conftest.py index 9479ec99a55..7a9998f600f 100644 --- a/tests/integ/modin/conftest.py +++ b/tests/integ/modin/conftest.py @@ -14,7 +14,6 @@ from pytest import fail import snowflake.snowpark.modin.plugin # noqa: F401 -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.pandas_api_coverage import PandasAPICoverageGenerator from tests.integ.modin.sql_counter import ( SqlCounter, @@ -22,7 +21,7 @@ generate_sql_count_report, is_sql_counter_called, ) -from tests.utils import Utils +from tests.utils import Utils, running_on_public_ci INTEG_PANDAS_SUBPATH = "tests/integ/modin/" diff --git a/tests/integ/modin/frame/test_iloc.py b/tests/integ/modin/frame/test_iloc.py index 5246e5c4661..38ee81ce22f 100644 --- a/tests/integ/modin/frame/test_iloc.py +++ b/tests/integ/modin/frame/test_iloc.py @@ -19,7 +19,6 @@ import snowflake.snowpark.modin.plugin # noqa: F401 from snowflake.snowpark.exceptions import SnowparkSQLException from snowflake.snowpark.modin.pandas.utils import try_convert_index_to_native -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.frame.test_head_tail import eval_result_and_query_with_no_join from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import ( @@ -27,6 +26,7 @@ assert_snowpark_pandas_equal_to_pandas, eval_snowpark_pandas_result, ) +from tests.utils import running_on_public_ci # default_index_snowpark_pandas_df and default_index_native_df have size of axis_len x axis_len AXIS_LEN = 7 diff --git a/tests/integ/modin/frame/test_itertuples.py b/tests/integ/modin/frame/test_itertuples.py index 7f396a20d19..c3687a939c7 100644 --- a/tests/integ/modin/frame/test_itertuples.py +++ b/tests/integ/modin/frame/test_itertuples.py @@ -9,9 +9,9 @@ import snowflake.snowpark.modin.plugin # noqa: F401 from snowflake.snowpark.modin.pandas.snow_partition_iterator import PARTITION_SIZE -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import eval_snowpark_pandas_result +from tests.utils import running_on_public_ci # To generate seeded random data. rng = np.random.default_rng(12345) diff --git a/tests/integ/modin/frame/test_loc.py b/tests/integ/modin/frame/test_loc.py index f9d6a92297b..67fe61c96f8 100644 --- a/tests/integ/modin/frame/test_loc.py +++ b/tests/integ/modin/frame/test_loc.py @@ -15,7 +15,6 @@ import snowflake.snowpark.modin.plugin # noqa: F401 from snowflake.snowpark.exceptions import SnowparkSQLException from snowflake.snowpark.modin.pandas.utils import try_convert_index_to_native -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import ( assert_frame_equal, @@ -24,6 +23,7 @@ eval_snowpark_pandas_result, generate_a_random_permuted_list_exclude_self, ) +from tests.utils import running_on_public_ci EMPTY_LIST_LIKE_VALUES = [ [], diff --git a/tests/integ/modin/frame/test_transpose.py b/tests/integ/modin/frame/test_transpose.py index 7e01cf0c1b7..894bbbbc1bc 100644 --- a/tests/integ/modin/frame/test_transpose.py +++ b/tests/integ/modin/frame/test_transpose.py @@ -17,13 +17,13 @@ from snowflake.snowpark.modin.plugin._internal.unpivot_utils import ( UNPIVOT_NULL_REPLACE_VALUE, ) -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import ( assert_snowpark_pandas_equal_to_pandas, assert_snowpark_pandas_equals_to_pandas_with_coerce_to_float64, eval_snowpark_pandas_result, ) +from tests.utils import running_on_public_ci transpose_and_double_transpose_parameterize = pytest.mark.parametrize( "transpose_operation, expected_query_count", diff --git a/tests/integ/modin/groupby/test_groupby_idxmax_idxmin.py b/tests/integ/modin/groupby/test_groupby_idxmax_idxmin.py index 5569fd9f62a..d26dfc31f19 100644 --- a/tests/integ/modin/groupby/test_groupby_idxmax_idxmin.py +++ b/tests/integ/modin/groupby/test_groupby_idxmax_idxmin.py @@ -7,7 +7,6 @@ import pytest import snowflake.snowpark.modin.plugin # noqa: F401 -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.groupby.conftest import multiindex_data from tests.integ.modin.sql_counter import sql_count_checker from tests.integ.modin.utils import ( @@ -15,6 +14,7 @@ create_test_dfs, eval_snowpark_pandas_result, ) +from tests.utils import running_on_public_ci @pytest.mark.parametrize("grouping_columns", ["B", ["A", "B"]]) diff --git a/tests/integ/modin/groupby/test_quantile.py b/tests/integ/modin/groupby/test_quantile.py index b9fdb61b57d..b14299fee63 100644 --- a/tests/integ/modin/groupby/test_quantile.py +++ b/tests/integ/modin/groupby/test_quantile.py @@ -9,9 +9,9 @@ import snowflake.snowpark.modin.plugin # noqa: F401 from snowflake.snowpark.exceptions import SnowparkSQLException -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import assert_snowpark_pandas_equal_to_pandas +from tests.utils import running_on_public_ci @pytest.mark.parametrize( diff --git a/tests/integ/modin/series/test_rename.py b/tests/integ/modin/series/test_rename.py index e0850cf891c..f86fdc77b80 100644 --- a/tests/integ/modin/series/test_rename.py +++ b/tests/integ/modin/series/test_rename.py @@ -14,9 +14,9 @@ from modin.pandas import Index, MultiIndex, Series import snowflake.snowpark.modin.plugin # noqa: F401 -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import assert_index_equal, assert_series_equal +from tests.utils import running_on_public_ci class TestRename: diff --git a/tests/integ/modin/strings/test_cat.py b/tests/integ/modin/strings/test_cat.py index b9c801b1dc7..f27e140bcfd 100644 --- a/tests/integ/modin/strings/test_cat.py +++ b/tests/integ/modin/strings/test_cat.py @@ -9,9 +9,9 @@ import snowflake.snowpark.modin.plugin # noqa: F401 from snowflake.snowpark.exceptions import SnowparkSQLException -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import SqlCounter from tests.integ.modin.utils import assert_snowpark_pandas_equal_to_pandas +from tests.utils import running_on_public_ci @pytest.fixture(scope="module", autouse=True) diff --git a/tests/integ/modin/strings/test_extract.py b/tests/integ/modin/strings/test_extract.py index 403696471da..f5e3b1f6f9d 100644 --- a/tests/integ/modin/strings/test_extract.py +++ b/tests/integ/modin/strings/test_extract.py @@ -9,9 +9,9 @@ import snowflake.snowpark.modin.plugin # noqa: F401 from snowflake.snowpark.exceptions import SnowparkSQLException -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import assert_snowpark_pandas_equal_to_pandas +from tests.utils import running_on_public_ci # TODO (SNOW-767685): This whole suite is skipped in ci run because those are tests for unsupported diff --git a/tests/integ/modin/strings/test_get_dummies.py b/tests/integ/modin/strings/test_get_dummies.py index 786c19bfacc..4c2833f0341 100644 --- a/tests/integ/modin/strings/test_get_dummies.py +++ b/tests/integ/modin/strings/test_get_dummies.py @@ -8,9 +8,9 @@ from pandas import _testing as tm import snowflake.snowpark.modin.plugin # noqa: F401 -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import sql_count_checker from tests.integ.modin.utils import assert_snowpark_pandas_equal_to_pandas +from tests.utils import running_on_public_ci # TODO (SNOW-767685): This whole suite is skipped in ci run because those are tests for unsupported diff --git a/tests/integ/modin/strings/test_strings.py b/tests/integ/modin/strings/test_strings.py index 69f02a6401d..26d800bd5a1 100644 --- a/tests/integ/modin/strings/test_strings.py +++ b/tests/integ/modin/strings/test_strings.py @@ -9,13 +9,13 @@ import snowflake.snowpark.modin.plugin # noqa: F401 from snowflake.snowpark.exceptions import SnowparkSQLException -from tests.integ.conftest import running_on_public_ci from tests.integ.modin.sql_counter import SqlCounter, sql_count_checker from tests.integ.modin.utils import ( assert_snowpark_pandas_equal_to_pandas, assert_snowpark_pandas_equals_to_pandas_without_dtypecheck, eval_snowpark_pandas_result, ) +from tests.utils import running_on_public_ci # This whole suite is skipped in ci run because those are tests for unsupported diff --git a/tests/integ/modin/test_session.py b/tests/integ/modin/test_session.py index 59865fceaef..f1d9acf9831 100644 --- a/tests/integ/modin/test_session.py +++ b/tests/integ/modin/test_session.py @@ -16,9 +16,9 @@ _get_active_sessions, _remove_session, ) -from tests.integ.conftest import running_on_jenkins, running_on_public_ci from tests.integ.modin.sql_counter import sql_count_checker from tests.integ.modin.utils import create_test_dfs, eval_snowpark_pandas_result +from tests.utils import running_on_jenkins, running_on_public_ci NO_ACTIVE_SESSION_ERROR_PATTERN = ( r"Snowpark pandas requires an active snowpark session, but there is none. " diff --git a/tests/utils.py b/tests/utils.py index 67139d366e7..dfc3fa0cc4d 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -9,6 +9,7 @@ import platform import random import string +import uuid from datetime import date, datetime, time from decimal import Decimal from typing import List, NamedTuple, Optional, Union @@ -89,6 +90,22 @@ ICEBERG_ENVIRONMENTS = {"dev", "aws"} IS_ICEBERG_SUPPORTED = os.getenv("cloud_provider", "dev") in ICEBERG_ENVIRONMENTS +RUNNING_ON_GH = os.getenv("GITHUB_ACTIONS") == "true" +RUNNING_ON_JENKINS = "JENKINS_HOME" in os.environ +TEST_SCHEMA = f"GH_JOB_{(str(uuid.uuid4()).replace('-', '_'))}" +if RUNNING_ON_JENKINS: + TEST_SCHEMA = f"JENKINS_JOB_{(str(uuid.uuid4()).replace('-', '_'))}" + + +def running_on_public_ci() -> bool: + """Whether tests are currently running on one of our public CIs.""" + return RUNNING_ON_GH + + +def running_on_jenkins() -> bool: + """Whether tests are currently running on a Jenkins node.""" + return RUNNING_ON_JENKINS + class Utils: @staticmethod