Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Hide the backend.qt4/5 rcparam deprecation warning in test suite. #10347

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 2 commits into from
Jan 30, 2018
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
19 changes: 14 additions & 5 deletions 19 lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import warnings
import re

from matplotlib import cbook
from matplotlib import cbook, testing
from matplotlib.cbook import mplDeprecation, deprecated, ls_mapper
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
from matplotlib.colors import is_color_like
Expand Down Expand Up @@ -266,19 +266,28 @@ def validate_backend(s):
return _validate_standard_backends(s)


@deprecated("2.2",
def validate_qt4(s):
# Don't spam the test suite with warnings every time the rcparams are
# reset. While it may seem better to use filterwarnings from within the
# test suite, pytest 3.1+ explicitly disregards warnings filters (pytest
# issue #2430).
if not testing.is_called_from_pytest():
cbook.warn_deprecated(
"2.2",
"The backend.qt4 rcParam was deprecated in version 2.2. In order "
"to force the use of a specific Qt4 binding, either import that "
"binding first, or set the QT_API environment variable.")
def validate_qt4(s):
return ValidateInStrings("backend.qt4", ['PyQt4', 'PySide', 'PyQt4v2'])(s)


@deprecated("2.2",
def validate_qt5(s):
# See comment re: validate_qt4.
if not testing.is_called_from_pytest():
cbook.warn_deprecated(
"2.2",
"The backend.qt5 rcParam was deprecated in version 2.2. In order "
"to force the use of a specific Qt5 binding, either import that "
"binding first, or set the QT_API environment variable.")
def validate_qt5(s):
return ValidateInStrings("backend.qt5", ['PyQt5', 'PySide2'])(s)


Expand Down
18 changes: 9 additions & 9 deletions 18 lib/matplotlib/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import functools
import warnings

import matplotlib
from matplotlib import cbook, rcParams, rcdefaults, use
import matplotlib as mpl
from matplotlib import cbook


def _is_list_like(obj):
Expand All @@ -15,7 +15,7 @@ def _is_list_like(obj):

def is_called_from_pytest():
"""Returns whether the call was done from pytest"""
return getattr(matplotlib, '_called_from_pytest', False)
return getattr(mpl, '_called_from_pytest', False)


def _copy_metadata(src_func, tgt_func):
Expand All @@ -26,13 +26,13 @@ def _copy_metadata(src_func, tgt_func):


def set_font_settings_for_testing():
rcParams['font.family'] = 'DejaVu Sans'
rcParams['text.hinting'] = False
rcParams['text.hinting_factor'] = 8
mpl.rcParams['font.family'] = 'DejaVu Sans'
mpl.rcParams['text.hinting'] = False
mpl.rcParams['text.hinting_factor'] = 8


def set_reproducibility_for_testing():
rcParams['svg.hashsalt'] = 'matplotlib'
mpl.rcParams['svg.hashsalt'] = 'matplotlib'


def setup():
Expand All @@ -51,12 +51,12 @@ def setup():
"Could not set locale to English/United States. "
"Some date-related tests may fail")

use('Agg', warn=False) # use Agg backend for these tests
mpl.use('Agg', warn=False) # use Agg backend for these tests

# These settings *must* be hardcoded for running the comparison
# tests and are not necessarily the default values as specified in
# rcsetup.py
rcdefaults() # Start with all defaults
mpl.rcdefaults() # Start with all defaults

set_font_settings_for_testing()
set_reproducibility_for_testing()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.