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

Skip to content

Commit 39c3194

Browse files
committed
raise SkipTest if not using Python >= 2.7
1 parent 8d3cd0c commit 39c3194

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/matplotlib/tests/test_rcparams.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from matplotlib.tests import assert_str_equal
1313
from matplotlib.testing.decorators import cleanup, knownfailureif
1414
from nose.tools import assert_true, assert_raises, assert_equal
15+
from nose.plugins.skip import SkipTest
1516
import nose
1617
from itertools import chain
1718
import numpy as np
@@ -270,10 +271,10 @@ def test_rcparams_reset_after_fail():
270271
# raised an exception due to issues in the supplied rc parameters, the
271272
# global rc parameters were left in a modified state.
272273

273-
try:
274+
if sys.version_info[:2] >= (2, 7):
274275
from collections import OrderedDict
275-
except ImportError:
276-
return # can't run this test on Python 2.6
276+
else:
277+
raise SkipTest("Test can only be run in Python >= 2.7 as it requires OrderedDict")
277278

278279
with mpl.rc_context(rc={'text.usetex': False}):
279280

0 commit comments

Comments
 (0)