Skip to content

Commit

Permalink
Use pytest.importorskip for pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
gselzer committed Jan 25, 2022
1 parent d092e07 commit 8c7efef
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_return_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
from inspect import signature

import numpy as np
import pandas as pd
import pytest

from magicgui import magicgui, widgets


def _dataframe_equals(object1: pd.DataFrame, object2: pd.DataFrame):
def _dataframe_equals(object1, object2):
assert object1.equals(object2)


Expand All @@ -25,10 +24,17 @@ def _default_equals(object1, object2):
assert object1 == object2


def _generate_pandas_test_data():
pd = pytest.importorskip(
"pandas", reason="Pandas required for a return widget test"
)
return pd.DataFrame({"Res1": [1, 2, 3], "Res2": [4, 5, 6]})


parameterizations = [
# pandas dataframe
(
pd.DataFrame({"Res1": [1, 2, 3], "Res2": [4, 5, 6]}),
_generate_pandas_test_data(),
widgets.Table,
_dataframe_equals,
),
Expand Down

0 comments on commit 8c7efef

Please sign in to comment.