Skip to content

Commit 6c46b99

Browse files
committed
skip test if pandas doesn't exist
1 parent dba641e commit 6c46b99

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bindings/python/test/test_arrow.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import pyarrow as pa
2828
import pyarrow.json
2929
import pymongo
30+
import pytest
3031
from bson import Binary, Code, CodecOptions, Decimal128, ObjectId, json_util
3132
from pyarrow import (
3233
Table,
@@ -63,6 +64,11 @@
6364
ObjectIdType,
6465
)
6566

67+
try:
68+
import pandas as pd
69+
except ImportError:
70+
pd = None
71+
6672
HERE = Path(__file__).absolute().parent
6773

6874

@@ -1145,7 +1151,6 @@ def compare_arrow_mongodb_data(self, arrow_table, mongo_data):
11451151
import decimal
11461152

11471153
import numpy as np
1148-
import pandas as pd
11491154

11501155
assert len(mongo_data) == len(arrow_table), "MongoDB data length mismatch with Arrow Table."
11511156

@@ -1185,6 +1190,8 @@ def test_all_types(self):
11851190
"""
11861191
Test the conversion of all standard data types from Parquet → PyArrow → Python → BSON.
11871192
"""
1193+
if pd is None:
1194+
pytest.skip("Requires pandas.", allow_module_level=True)
11881195
df = self.alltypes_sample(size=100, seed=42, categorical=True)
11891196
arrow_table = pa.Table.from_pandas(df)
11901197
arrow_table = self.convert_categorical_columns_to_string(arrow_table)

0 commit comments

Comments
 (0)