Skip to content

Commit a5f792b

Browse files
committed
add fixture
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 2fec0b2 commit a5f792b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,18 @@ def test_build_df_with_index():
234234
assert_frame_equal(tips.reset_index()[out["data_frame"].columns], out["data_frame"])
235235

236236

237-
def test_build_df_using_interchange_protocol_mock():
237+
@pytest.fixture
238+
def add_interchange_module_for_old_pandas():
239+
if not hasattr(pd.api, "interchange"):
240+
pd.api.interchange = mock.MagicMock()
241+
# to make the following import work: `import pandas.api.interchange`
242+
with mock.patch.dict("sys.modules", {"pandas.api.interchange": pd.api.interchange}):
243+
yield
244+
else:
245+
yield
246+
247+
248+
def test_build_df_using_interchange_protocol_mock(add_interchange_module_for_old_pandas):
238249
class CustomDataFrame:
239250
def __dataframe__(self):
240251
pass

0 commit comments

Comments
 (0)