Drop old Python checks by QuLogic · Pull Request #7316 · matplotlib/matplotlib · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/compat/subprocess.py
5 changes: 0 additions & 5 deletions lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
unicode_literals)

import six
import sys
import io
import os

Expand Down Expand Up @@ -573,10 +572,6 @@ def test_minimized_rasterized():
# in Postscript, the best way to detect it is to generate SVG
# and then parse the output to make sure the two colorbar images
# are the same size.
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("xml.etree.ElementTree.Element.iter "
"added in py 2.7")

from xml.etree import ElementTree

np.random.seed(0)
Expand Down
10 changes: 0 additions & 10 deletions lib/matplotlib/tests/test_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup, image_comparison

import sys


@cleanup
def test_invisible_Line_rendering():
Expand Down Expand Up @@ -112,10 +110,6 @@ def test_linestyle_variants():

@cleanup
def test_valid_linestyles():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
"not supported with Python < 2.7")

line = mlines.Line2D([], [])
with assert_raises(ValueError):
line.set_linestyle('aardvark')
Expand All @@ -135,10 +129,6 @@ def test_drawstyle_variants():

@cleanup
def test_valid_drawstyles():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
"not supported with Python < 2.7")

line = mlines.Line2D([], [])
with assert_raises(ValueError):
line.set_drawstyle('foobar')
Expand Down
25 changes: 1 addition & 24 deletions lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import io
import os
import sys
import warnings
from collections import OrderedDict

from cycler import cycler, Cycler

Expand All @@ -16,7 +16,6 @@
from matplotlib.testing.decorators import cleanup, knownfailureif
import matplotlib.colors as mcolors
from nose.tools import assert_true, assert_raises, assert_equal
from nose.plugins.skip import SkipTest
import nose
from itertools import chain
import numpy as np
Expand Down Expand Up @@ -115,9 +114,6 @@ def test_RcParams_class():


def test_rcparams_update():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
"not supported with Python < 2.7")
rc = mpl.RcParams({'figure.figsize': (3.5, 42)})
bad_dict = {'figure.figsize': (3.5, 42, 1)}
# make sure validation happens on input
Expand All @@ -131,9 +127,6 @@ def test_rcparams_update():


def test_rcparams_init():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
"not supported with Python < 2.7")
with assert_raises(ValueError):
with warnings.catch_warnings():
warnings.filterwarnings('ignore',
Expand Down Expand Up @@ -172,14 +165,6 @@ def test_Bug_2543():
mpl.rcParams['svg.embed_char_paths'] = False
assert_true(mpl.rcParams['svg.fonttype'] == "none")


@cleanup
def test_Bug_2543_newer_python():
# only split from above because of the usage of assert_raises
# as a context manager, which only works in 2.7 and above
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager not supported with Python < 2.7")
from matplotlib.rcsetup import validate_bool_maybe_none, validate_bool
with assert_raises(ValueError):
validate_bool_maybe_none("blah")
with assert_raises(ValueError):
Expand Down Expand Up @@ -249,9 +234,6 @@ def _validation_test_helper(validator, arg, target):


def _validation_fail_helper(validator, arg, exception_type):
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager not "
"supported with Python < 2.7")
with assert_raises(exception_type):
validator(arg)

Expand Down Expand Up @@ -395,11 +377,6 @@ def test_rcparams_reset_after_fail():
# raised an exception due to issues in the supplied rc parameters, the
# global rc parameters were left in a modified state.

if sys.version_info[:2] >= (2, 7):
from collections import OrderedDict
else:
raise SkipTest("Test can only be run in Python >= 2.7 as it requires OrderedDict")

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

assert mpl.rcParams['text.usetex'] is False
Expand Down
9 changes: 1 addition & 8 deletions lib/matplotlib/tests/test_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
unicode_literals)

import os
import sys
import shutil
import tempfile
from collections import OrderedDict
from contextlib import contextmanager

from nose import SkipTest
from nose.tools import assert_raises
from nose.plugins.attrib import attr

Expand Down Expand Up @@ -121,12 +120,6 @@ def test_context_with_union_of_dict_and_namedstyle():


def test_context_with_badparam():
if sys.version_info[:2] >= (2, 7):
from collections import OrderedDict
else:
m = "Test can only be run in Python >= 2.7 as it requires OrderedDict"
raise SkipTest(m)

original_value = 'gray'
other_value = 'blue'
d = OrderedDict([(PARAM, original_value), ('badparam', None)])
Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import numpy as np
from numpy.testing import assert_almost_equal
from nose.tools import eq_, assert_raises
from nose.plugins.skip import SkipTest

from matplotlib.transforms import Bbox
import matplotlib
Expand Down Expand Up @@ -287,10 +286,6 @@ def test_get_rotation_int():

def test_get_rotation_raises():
from matplotlib import text
import sys
if sys.version_info[:2] < (2, 7):
raise SkipTest("assert_raises as context manager "
"not supported with Python < 2.7")
with assert_raises(ValueError):
text.get_rotation('hozirontal')

Expand Down
5 changes: 0 additions & 5 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys
import nose
from nose.tools import assert_raises
from mpl_toolkits.mplot3d import Axes3D, axes3d
from matplotlib import cm
Expand Down Expand Up @@ -218,9 +216,6 @@ def test_wireframe3dzerorstride():

@cleanup
def test_wireframe3dzerostrideraises():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
"not supported with Python < 2.7")
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)
Expand Down
31 changes: 11 additions & 20 deletions setupext.py