Skip to content

Commit f801bd0

Browse files
authored
SNOW-1852428: Remove error print in try/catch (#2787)
1 parent 872b583 commit f801bd0

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/snowflake/snowpark/_internal/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ def _pandas_importer(): # noqa: E302
211211
pandas = importlib.import_module("pandas")
212212
# since we enable relative imports without dots this import gives us an issues when ran from test directory
213213
from pandas import DataFrame # NOQA
214-
except ImportError as e:
215-
_logger.error(f"pandas is not installed {e}")
214+
except ImportError: # pragma: no cover
215+
pass # pragma: no cover
216216
return pandas
217217

218218

tests/unit/test_internal_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
#
44

55
import pytest
6+
from snowflake.connector.options import MissingPandas
67

78
from snowflake.snowpark._internal import utils
9+
from snowflake.snowpark._internal.utils import _pandas_importer
810

911

1012
@pytest.mark.parametrize(
@@ -65,3 +67,13 @@ def test_split_path(path: str, expected_dir: str, expected_file: str) -> None:
6567
def test_normalize_path(path: str, is_local: bool, expected: str) -> None:
6668
actual = utils.normalize_path(path, is_local)
6769
assert expected == actual
70+
71+
72+
def test__pandas_importer():
73+
imported_pandas = _pandas_importer()
74+
try:
75+
import pandas
76+
77+
assert imported_pandas == pandas
78+
except ImportError:
79+
assert imported_pandas == MissingPandas

0 commit comments

Comments
 (0)