From d9f4bed5affaf535732e2c965a50aba493488400 Mon Sep 17 00:00:00 2001 From: Benjamin Bengfort Date: Tue, 5 Feb 2019 21:20:21 -0500 Subject: [PATCH] Hotfix v0.9.1: matplotlib 3 support (#724) This hotfix adds matplotlib3 support by requiring any version of mpl except for 3.0.0 which had a backend bug that affected Yellowbrick. Note that this hotfix includes changes to tests that will need to be resolved when merging from develop. --- docs/requirements.txt | 2 +- requirements.txt | 2 +- tests/__init__.py | 2 +- tests/requirements.txt | 4 ++-- tests/test_classifier/test_confusion_matrix.py | 3 +++ tests/test_classifier/test_threshold.py | 2 +- tests/test_contrib/test_scatter.py | 11 ++++++++++- yellowbrick/version.py | 2 +- 8 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 0cc16735a..bc5a0d332 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ # Library Dependencies -matplotlib>=1.5.1,<3.0 +matplotlib>=1.5.1,!=3.0.0 scipy>=0.19 scikit-learn>=0.19 numpy>=1.13.0 diff --git a/requirements.txt b/requirements.txt index db10367cc..b7f02d62b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ## Dependencies -matplotlib>=1.5.1,<3.0 +matplotlib>=1.5.1,!=3.0.0 scipy>=1.0.0 scikit-learn>=0.20 numpy>=1.13.0 diff --git a/tests/__init__.py b/tests/__init__.py index 134c73e0f..eb9ab5155 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -28,7 +28,7 @@ ## Test Constants ########################################################################## -EXPECTED_VERSION = "0.9" +EXPECTED_VERSION = "0.9.1" ########################################################################## diff --git a/tests/requirements.txt b/tests/requirements.txt index bc71ca7a1..64bf01d3a 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,12 +1,12 @@ # Library Dependencies -matplotlib>=1.5.1,<3.0 +matplotlib>=1.5.1,!=3.0.0 scipy>=0.19 scikit-learn>=0.19 numpy>=1.13.0 cycler>=0.10.0 # Testing Requirements -pytest>=3.4.1 +pytest>=3.4.1,<4.2.0 pytest-cov>=2.5.1 pytest-flakes>=2.0.0 pytest-spec>=1.1.0 diff --git a/tests/test_classifier/test_confusion_matrix.py b/tests/test_classifier/test_confusion_matrix.py index 2d2c1ebea..5d0d1e5ba 100644 --- a/tests/test_classifier/test_confusion_matrix.py +++ b/tests/test_classifier/test_confusion_matrix.py @@ -334,6 +334,9 @@ def test_isclassifier(self): with pytest.raises(yb.exceptions.YellowbrickError, match=message): ConfusionMatrix(model) + @pytest.mark.xfail( + sys.platform == 'win32', reason="Changing the dtype to a subarray type is only supported if the total itemsize is unchanged" + ) def test_score_returns_score(self): """ Test that ConfusionMatrix score() returns a score between 0 and 1 diff --git a/tests/test_classifier/test_threshold.py b/tests/test_classifier/test_threshold.py index 4a977bfde..f39d8b44e 100644 --- a/tests/test_classifier/test_threshold.py +++ b/tests/test_classifier/test_threshold.py @@ -295,7 +295,7 @@ def test_splitter_random_state(self): assert viz._check_cv(splits, random_state=23).random_state == 23 splits = StratifiedShuffleSplit(n_splits=1, random_state=181) - assert viz._check_cv(splits, random_state=None).random_state is 181 + assert viz._check_cv(splits, random_state=None).random_state == 181 assert viz._check_cv(splits, random_state=72).random_state == 72 def test_bad_exclude(self): diff --git a/tests/test_contrib/test_scatter.py b/tests/test_contrib/test_scatter.py index b6cb279e6..082d2e992 100644 --- a/tests/test_contrib/test_scatter.py +++ b/tests/test_contrib/test_scatter.py @@ -16,6 +16,7 @@ # Imports ########################################################################## +import sys import pytest import numpy as np import matplotlib as mptl @@ -137,6 +138,9 @@ def test_scatter_requires_two_features_in_numpy_matrix(self): self.assertTrue( 'only accepts two features' in str(context.exception)) + @pytest.mark.xfail( + sys.platform == 'win32', reason="Changing the dtype to a subarray type is only supported if the total itemsize is unchanged" + ) def test_integrated_scatter(self): """ Test scatter on the real, occupancy data set @@ -174,7 +178,9 @@ def test_alpha_param(self): assert "alpha" in scatter_kwargs assert scatter_kwargs["alpha"] == 0.7 - + @pytest.mark.xfail( + sys.platform == 'win32', reason="Changing the dtype to a subarray type is only supported if the total itemsize is unchanged" + ) def test_scatter_quick_method(self): """ Test scatter quick method on the real, occupancy data set @@ -217,6 +223,9 @@ def test_integrated_scatter_with_pandas(self): visualizer = ScatterViz(features=features) visualizer.fit_transform_poof(X, y) + @pytest.mark.xfail( + sys.platform == 'win32', reason="Changing the dtype to a subarray type is only supported if the total itemsize is unchanged" + ) def test_integrated_scatter_numpy_named_arrays(self): """ Test scatterviz on numpy named arrays diff --git a/yellowbrick/version.py b/yellowbrick/version.py index b50b7df0a..5c2b96e3a 100644 --- a/yellowbrick/version.py +++ b/yellowbrick/version.py @@ -20,7 +20,7 @@ __version_info__ = { 'major': 0, 'minor': 9, - 'micro': 0, + 'micro': 1, 'releaselevel': 'final', 'serial': 13, }