Skip to content
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

Repair broken tests with matplotlib 3.3 #1090

Merged
merged 15 commits into from
Aug 6, 2020
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
11 changes: 6 additions & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
image:
- Previous Visual Studio 2017

version: 0.9.{build}
version: 1.1.{build}
pull_requests:
do_not_increment_build_number: true

Expand Down Expand Up @@ -36,10 +36,11 @@ environment:
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Miniconda36-x64"
PYTHON_VERSION: "3.6"
MINICONDA_VERSION: "4.8.2"
PYTHON_ARCH: "64"
# Tests hang indefinitely
# - PYTHON: "C:\\Miniconda36-x64"
# PYTHON_VERSION: "3.6"
# MINICONDA_VERSION: "4.8.2"
# PYTHON_ARCH: "64"

# Failing Tests Due to TypeError: LoadLibrary()
# - PYTHON: "C:\\Miniconda37-x64"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline_images/test_draw/test_manual_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline_images/test_features/test_pca/test_biplot_3d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Library Dependencies
matplotlib>=3.2.1
matplotlib>=3.3
scipy>=1.0.0
scikit-learn>=0.20
numpy>=1.13.0
Expand Down
9 changes: 6 additions & 3 deletions tests/test_features/test_jointplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ def test_columns_single_int_index_numpy_hist(self):
assert hasattr(oz, "corr_")

oz.finalize()
self.assert_images_similar(oz)
# Python 3.6 Travis ImageComparisonFailure: images not close (RMS 0.837)
self.assert_images_similar(oz, tol=1.0)

@pytest.mark.skipif(pd is None, reason="test requires pandas")
@pytest.mark.xfail(
Expand All @@ -426,7 +427,8 @@ def test_columns_single_str_index_pandas_hist(self):
assert hasattr(oz, "corr_")

oz.finalize()
self.assert_images_similar(oz)
# Python 3.6 Travis ImageComparisonFailure: images not close (RMS 1.109)
self.assert_images_similar(oz, tol=1.5)

@pytest.mark.xfail(
IS_WINDOWS_OR_CONDA,
Expand Down Expand Up @@ -505,4 +507,5 @@ def test_quick_method(self):
assert isinstance(oz, JointPlot)
assert hasattr(oz, "corr_")

self.assert_images_similar(oz)
# Python 3.6 Travis ImageComparisonFailure: images not close (RMS 0.837)
self.assert_images_similar(oz, tol=1.0)
3 changes: 2 additions & 1 deletion tests/test_features/test_rankd.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ def test_rank2d_pearson(self):

# Image similarity comparision
oz.finalize()
self.assert_images_similar(oz, tol=0.1)
# Travis Python 3.6 images not close (RMS 0.112)
self.assert_images_similar(oz, tol=0.5)

@pytest.mark.xfail(
IS_WINDOWS_OR_CONDA,
Expand Down
6 changes: 4 additions & 2 deletions tests/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,13 @@ def test_random_visualizer_not_close(self):
"""
Test that not close visualizers raise an assertion error.
"""
# Baseline image random_state=225
viz = RandomVisualizer(random_state=224).fit()
# Baseline image random_state=224
# NOTE: if regenerating baseline images, skip this one or change random state!
viz = RandomVisualizer(random_state=225).fit()
viz.finalize()

with pytest.raises(ImageComparisonFailure, match="images not close"):
# If failing, perhaps baseline images were regenerated? See note above.
self.assert_images_similar(viz)

# Assert there is a diff
Expand Down
Binary file added tests/test_random_visualizer_not_close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion tests/test_regressor/test_alphas.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,5 @@ def test_quick_method_manual(self):
ElasticNet(random_state=0), X, y, cv=3, is_fitted=False, show=False
)
assert isinstance(visualizer, ManualAlphaSelection)
self.assert_images_similar(visualizer)
# Python 3.6 Travis images not similar (RMS 0.024)
self.assert_images_similar(visualizer, tol=0.5)
16 changes: 16 additions & 0 deletions tests/test_style/test_rcmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ class RCParamTester(VisualTestCase):
"backend", # This cannot be changed by manipulating rc
"svg.embed_char_paths", # This param causes test issues and is deprecated
"font.family", # breaks the visualtest case

# The following are not able to be set by a style in matplotlib 2.0
# See: https://bit.ly/39UWTCY
"interactive",
"backend.qt4",
"webagg.port",
"webagg.port_retries",
"webagg.open_in_browser",
"backend_fallback",
"toolbar",
"timezone",
"datapath",
"figure.max_open_warning",
"savefig.directory",
"tk.window_focus",
"docstring.hardcopy",
Comment on lines +45 to +59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebeccabilbro did a lot of work regenerating baseline images for binning, class balance, feature correlation, dispersion plot, freqdist, postag, and tsne - but somehow adding these lines to the exclude function managed to revert them to their original state (well fingers crossed, it worked on my MacBook, but not sure about CI). The changes seemed to be related to grid lines and bar colors.

current working hypothesis - we were setting one of these values unintentionally and as a result, matplotlib was ignoring all of our styles, by excluding them, the styles work as expected?

But you know … that's just a hypothesis, I really have no clue what is actually happening.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebeccabilbro I did build the docs and everything was fine - and the figures generated by the plot directive were as I expected, RE grid lines and colors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still flummoxed by this … 🤷

}

def flatten_list(self, orig_list):
Expand Down