Skip to content

Commit

Permalink
add test to snowpark pandas ci
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-joshi committed Aug 20, 2024
1 parent 46eeaec commit cbd3d28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions tests/integ/test_df_to_snowpark_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
from snowflake.snowpark._internal.utils import TempObjectType
from tests.utils import Utils

pytestmark = [
pytest.mark.xfail(
"config.getoption('local_testing_mode', default=False)",
reason="This is testing Snowpark pandas installation",
run=False,
)
]


@pytest.fixture(scope="module")
def tmp_table_basic(session):
Expand All @@ -29,11 +37,14 @@ def tmp_table_basic(session):

def test_to_snowpark_pandas_no_modin(session, tmp_table_basic):
snowpark_df = session.table(tmp_table_basic)
# Check if modin is installed
# Check if modin is installed (if so, we're running in Snowpark pandas; if not, we're just in Snowpark Python)
try:
import modin # noqa: F401

snowpark_df.to_snowpark_pandas() # should have no errors
except ModuleNotFoundError:
with pytest.raises(ModuleNotFoundError, match="Modin is not installed."):
with pytest.raises(
ModuleNotFoundError,
match=r"(Modin is not installed)|(does not match the supported pandas version in Modin)",
):
snowpark_df.to_snowpark_pandas()
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ commands =
local: {env:SNOWFLAKE_PYTEST_CMD} --local_testing_mode -m "integ or unit or mock" {posargs:} tests
dailynotdoctest: {env:SNOWFLAKE_PYTEST_DAILY_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} or udf" {posargs:} tests
# Snowpark pandas commands:
snowparkpandasnotdoctest: {env:MODIN_PYTEST_CMD} --durations=20 -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} {env:SNOW_1314507_WORKAROUND_RERUN_FLAGS} tests/unit/modin tests/integ/modin
snowparkpandasnotdoctest: {env:MODIN_PYTEST_CMD} --durations=20 -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} {env:SNOW_1314507_WORKAROUND_RERUN_FLAGS} tests/unit/modin tests/integ/modin tests/integ/test_df_to_snowpark_pandas.py
# This one only run doctest but we still need to include the tests folder to let tests/conftest.py to mark the doctest files for us
snowparkpandasdoctest: {env:MODIN_PYTEST_CMD} --durations=20 -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} src/snowflake/snowpark/modin/ tests/unit/modin
# This one is used by daily_modin_precommit.yml
snowparkpandasdailynotdoctest: {env:MODIN_PYTEST_DAILY_CMD} --durations=20 -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} {env:SNOW_1314507_WORKAROUND_RERUN_FLAGS} tests/unit/modin tests/integ/modin
snowparkpandasdailynotdoctest: {env:MODIN_PYTEST_DAILY_CMD} --durations=20 -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} {env:SNOW_1314507_WORKAROUND_RERUN_FLAGS} tests/unit/modin tests/integ/modin tests/integ/test_df_to_snowpark_pandas.py
# This one is only called by jenkins job and the only difference from `snowparkpandasnotdoctest` is that it uses
# MODIN_PYTEST_NO_COV_CMD instead of MODIN_PYTEST_CMD
snowparkpandasjenkins: {env:MODIN_PYTEST_NO_COV_CMD} --durations=20 -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} {env:SNOW_1314507_WORKAROUND_RERUN_FLAGS} tests/unit/modin tests/integ/modin
Expand Down

0 comments on commit cbd3d28

Please sign in to comment.