Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c632e41

Browse files
committed
Use pytest.importorskip for consistent skip message.
It's used in some places, but not all.
1 parent b71447f commit c632e41

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4655,10 +4655,7 @@ def test_broken_barh_empty():
46554655

46564656

46574657
def test_pandas_indexing_dates():
4658-
try:
4659-
import pandas as pd
4660-
except ImportError:
4661-
pytest.skip("Pandas not installed")
4658+
pd = pytest.importorskip('pandas')
46624659

46634660
dates = np.arange('2005-02', '2005-03', dtype='datetime64[D]')
46644661
values = np.sin(np.array(range(len(dates))))
@@ -4671,10 +4668,7 @@ def test_pandas_indexing_dates():
46714668

46724669

46734670
def test_pandas_errorbar_indexing():
4674-
try:
4675-
import pandas as pd
4676-
except ImportError:
4677-
pytest.skip("Pandas not installed")
4671+
pd = pytest.importorskip('pandas')
46784672

46794673
df = pd.DataFrame(np.random.uniform(size=(5, 4)),
46804674
columns=['x', 'y', 'xe', 'ye'],
@@ -4684,10 +4678,7 @@ def test_pandas_errorbar_indexing():
46844678

46854679

46864680
def test_pandas_indexing_hist():
4687-
try:
4688-
import pandas as pd
4689-
except ImportError:
4690-
pytest.skip("Pandas not installed")
4681+
pd = pytest.importorskip('pandas')
46914682

46924683
ser_1 = pd.Series(data=[1, 2, 2, 3, 3, 4, 4, 4, 4, 5])
46934684
ser_2 = ser_1.iloc[1:]

0 commit comments

Comments
 (0)