Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion tests/ast/test_ast_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ def load_test_cases():
Returns: a list of test cases.
"""
test_files = DATA_DIR.glob("*.test")
if sys.version_info[0] == 3 and sys.version_info[1] < 9:
major_version, minor_version = sys.version_info[0], sys.version_info[1]
if major_version == 3 and minor_version < 9:
# Remove the `to_snowpark_pandas` test since Snowpark pandas is only supported in Python 3.9+.
test_files = filter(
lambda file: "to_snowpark_pandas" not in file.name, test_files
)
if major_version == 3 and minor_version == 12:
# Skip df_copy when run in Python 3.12 due to differences in reported source positions.
test_files = filter(lambda file: "df_copy" not in file.name, test_files)
return [parse_file(file) for file in test_files]


Expand Down
7 changes: 7 additions & 0 deletions tests/integ/test_df_to_snowpark_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ def tmp_table_basic(session):
@pytest.mark.parametrize("enforce_ordering", [True, False])
def test_to_snowpark_pandas_no_modin(session, tmp_table_basic, enforce_ordering):
snowpark_df = session.table(tmp_table_basic)
# If pandas isn't installed, then an error is raised immediately.
try:
import pandas # noqa: F401
except ModuleNotFoundError:
with pytest.raises(ModuleNotFoundError, match="No module named 'pandas'"):
snowpark_df.to_snowpark_pandas(enforce_ordering=enforce_ordering)
return
# 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
Expand Down
Loading