Skip to content

Switch testing to pytest completely #7974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Feb 3, 2017
Prev Previous commit
Next Next commit
Skip broken category test with NumPy < 1.8.0.
  • Loading branch information
QuLogic committed Feb 2, 2017
commit 30e40c68eb6cd7cf4a68cab03f43d059bbbb88aa
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)

from distutils.version import LooseVersion

import pytest
import numpy as np

Expand All @@ -12,6 +14,11 @@
import unittest


needs_new_numpy = pytest.mark.xfail(
LooseVersion(np.__version__) < LooseVersion('1.8.0'),
reason='NumPy < 1.8.0 is broken.')


class TestUnitData(object):
testdata = [("hello world", ["hello world"], [0]),
("Здравствуйте мир", ["Здравствуйте мир"], [0]),
Expand All @@ -21,12 +28,14 @@ class TestUnitData(object):

ids = ["single", "unicode", "mixed"]

@needs_new_numpy
@pytest.mark.parametrize("data, seq, locs", testdata, ids=ids)
def test_unit(self, data, seq, locs):
act = cat.UnitData(data)
assert act.seq == seq
assert act.locs == locs

@needs_new_numpy
def test_update_map(self):
data = ['a', 'd']
oseq = ['a', 'd']
Expand Down Expand Up @@ -78,6 +87,7 @@ class TestStrCategoryConverter(object):
def mock_axis(self, request):
self.cc = cat.StrCategoryConverter()

@needs_new_numpy
@pytest.mark.parametrize("data, unitmap, exp", testdata, ids=ids)
def test_convert(self, data, unitmap, exp):
MUD = MockUnitData(unitmap)
Expand Down