File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -519,14 +519,14 @@ def test_finder_hourly(self):
519
519
xp = Period ('1/1/1999' , freq = 'H' ).ordinal
520
520
assert rs == xp
521
521
522
+ @td .skip_if_mpl_1_5
522
523
@pytest .mark .slow
523
524
def test_gaps (self ):
524
525
ts = tm .makeTimeSeries ()
525
526
ts [5 :25 ] = np .nan
526
527
_ , ax = self .plt .subplots ()
527
528
ts .plot (ax = ax )
528
529
lines = ax .get_lines ()
529
- tm ._skip_if_mpl_1_5 ()
530
530
assert len (lines ) == 1
531
531
l = lines [0 ]
532
532
data = l .get_xydata ()
@@ -564,6 +564,7 @@ def test_gaps(self):
564
564
mask = data .mask
565
565
assert mask [2 :5 , 1 ].all ()
566
566
567
+ @td .skip_if_mpl_1_5
567
568
@pytest .mark .slow
568
569
def test_gap_upsample (self ):
569
570
low = tm .makeTimeSeries ()
@@ -580,8 +581,6 @@ def test_gap_upsample(self):
580
581
l = lines [0 ]
581
582
data = l .get_xydata ()
582
583
583
- tm ._skip_if_mpl_1_5 ()
584
-
585
584
assert isinstance (data , np .ma .core .MaskedArray )
586
585
mask = data .mask
587
586
assert mask [5 :25 , 1 ].all ()
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ def test_foo():
25
25
"""
26
26
27
27
import pytest
28
+ from distutils .version import LooseVersion
28
29
29
30
30
31
def safe_import (mod_name , min_version = None ):
@@ -67,5 +68,18 @@ def _skip_if_no_mpl():
67
68
return True
68
69
69
70
71
+ def _skip_if_mpl_1_5 ():
72
+ mod = safe_import ("matplotlib" )
73
+
74
+ if mod :
75
+ v = mod .__version__
76
+ if LooseVersion (v ) > LooseVersion ('1.4.3' ) or str (v )[0 ] == '0' :
77
+ return True
78
+ else :
79
+ mod .use ("Agg" , warn = False )
80
+
81
+
70
82
skip_if_no_mpl = pytest .mark .skipif (_skip_if_no_mpl (),
71
83
reason = "Missing matplotlib dependency" )
84
+ skip_if_mpl_1_5 = pytest .mark .skipif (_skip_if_mpl_1_5 (),
85
+ reason = "matplotlib 1.5" )
You can’t perform that action at this time.
0 commit comments