Issue 1:
Hello,

i'm reporting here the errors produced by the test suite when running on debian amd64:

python 2.7.15:

=================================== FAILURES ===================================
_____________________________ test_log_scales[png] _____________________________

self = <CallInfo when='call' exception: Image sizes do not match expected size: (600, 800, 3) actual size (600, 800, 4)>
func = <function <lambda> at 0x7f13fab3e410>, when = 'call'

def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

> return CallInfo(lambda: ihook(item=item, **kwds), when=when)

/usr/lib/python2.7/dist-packages/_pytest/runner.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_runtest_call'>, args = ()
kwargs = {'item': <Function 'test_log_scales[png]'>}, notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f140b120f50>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f140a075a10>, <pluggy.HookImpl object at 0x7f1409fb5ad0>, <pluggy.HookImpl object at 0x7f1409fc27d0>]
kwargs = {'item': <Function 'test_log_scales[png]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f140a075a10>, <pluggy.HookImpl object at 0x7f1409fb5ad0>, <pluggy.HookImpl object at 0x7f1409fc27d0>]
kwargs = {'item': <Function 'test_log_scales[png]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <Function 'test_log_scales[png]'>

def pytest_runtest_call(item):
_update_current_test_var(item, 'call')
try:
> item.runtest()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Function 'test_log_scales[png]'>

def runtest(self):
""" execute the underlying test function. """
> self.ihook.pytest_pyfunc_call(pyfuncitem=self)

/usr/lib/python2.7/dist-packages/_pytest/python.py:1171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_pyfunc_call'>, args = ()
kwargs = {'pyfuncitem': <Function 'test_log_scales[png]'>}, notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f140b120f50>
hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f140a086090>, <pluggy.HookImpl object at 0x7f140a028090>]
kwargs = {'pyfuncitem': <Function 'test_log_scales[png]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f140a086090>, <pluggy.HookImpl object at 0x7f140a028090>]
kwargs = {'pyfuncitem': <Function 'test_log_scales[png]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pyfuncitem = <Function 'test_log_scales[png]'>

@hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem):
testfunction = pyfuncitem.obj
if pyfuncitem._isyieldedfunction():
testfunction(*pyfuncitem._args)
else:
funcargs = pyfuncitem.funcargs
testargs = {}
for arg in pyfuncitem._fixtureinfo.argnames:
testargs[arg] = funcargs[arg]
> testfunction(**testargs)

/usr/lib/python2.7/dist-packages/_pytest/python.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expected = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales-expected.png'
actual = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales.png'
tol = 0.306, in_decorator = True

def compare_images(expected, actual, tol, in_decorator=False):
"""
Compare two "image" files checking differences within a tolerance.

The two given filenames may point to files which are convertible to
PNG via the `.converter` dictionary. The underlying RMS is calculated
with the `.calculate_rms` function.

Parameters
----------
expected : str
The filename of the expected image.
actual :str
The filename of the actual image.
tol : float
The tolerance (a color value difference, where 255 is the
maximal difference). The test fails if the average pixel
difference is greater than this value.
in_decorator : bool
If called from image_comparison decorator, this should be
True. (default=False)

Examples
--------
img1 = "./baseline/plot.png"
img2 = "./output/plot.png"
compare_images( img1, img2, 0.001 ):

"""
if not os.path.exists(actual):
raise Exception("Output image %s does not exist." % actual)

if os.stat(actual).st_size == 0:
raise Exception("Output image file %s is empty." % actual)

# Convert the image to png
extension = expected.split('.')[-1]

if not os.path.exists(expected):
raise IOError('Baseline image %r does not exist.' % expected)

if extension != 'png':
actual = convert(actual, False)
expected = convert(expected, True)

# open the image files and remove the alpha channel (if it exists)
expectedImage = _png.read_png_int(expected)
actualImage = _png.read_png_int(actual)
expectedImage = expectedImage[:, :, :3]
actualImage = actualImage[:, :, :3]

actualImage, expectedImage = crop_to_same(
actual, actualImage, expected, expectedImage)

diff_image = make_test_filename(actual, 'failed-diff')

if tol <= 0.0:
if np.array_equal(expectedImage, actualImage):
return None

# convert to signed integers, so that the images can be subtracted without
# overflow
expectedImage = expectedImage.astype(np.int16)
actualImage = actualImage.astype(np.int16)

rms = calculate_rms(expectedImage, actualImage)

if rms <= tol:
return None

> save_diff_image(expected, actual, diff_image)

build/lib.linux-x86_64-2.7/matplotlib/testing/compare.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expected = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales-expected.png'
actual = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales.png'
output = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales-failed-diff.png'

def save_diff_image(expected, actual, output):
expectedImage = _png.read_png(expected)
actualImage = _png.read_png(actual)
actualImage, expectedImage = crop_to_same(
actual, actualImage, expected, expectedImage)
expectedImage = np.array(expectedImage).astype(float)
actualImage = np.array(actualImage).astype(float)
if expectedImage.shape != actualImage.shape:
raise ImageComparisonFailure(
"Image sizes do not match expected size: {0} "
> "actual size {1}".format(expectedImage.shape, actualImage.shape))
E ImageComparisonFailure: Image sizes do not match expected size: (600, 800, 3) actual size (600, 800, 4)

build/lib.linux-x86_64-2.7/matplotlib/testing/compare.py:471: ImageComparisonFailure
__________________ test_bbox_inches_tight_suptile_legend[png] __________________

self = <CallInfo when='call' exception: Image sizes do not match expected size: (593, 921, 3) actual size (592, 921, 3)>
func = <function <lambda> at 0x7f13f9af5ed8>, when = 'call'

def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

> return CallInfo(lambda: ihook(item=item, **kwds), when=when)

/usr/lib/python2.7/dist-packages/_pytest/runner.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_runtest_call'>, args = ()
kwargs = {'item': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f140b120f50>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f140a075a10>, <pluggy.HookImpl object at 0x7f1409fb5ad0>, <pluggy.HookImpl object at 0x7f1409fc27d0>]
kwargs = {'item': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f140a075a10>, <pluggy.HookImpl object at 0x7f1409fb5ad0>, <pluggy.HookImpl object at 0x7f1409fc27d0>]
kwargs = {'item': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <Function 'test_bbox_inches_tight_suptile_legend[png]'>

def pytest_runtest_call(item):
_update_current_test_var(item, 'call')
try:
> item.runtest()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Function 'test_bbox_inches_tight_suptile_legend[png]'>

def runtest(self):
""" execute the underlying test function. """
> self.ihook.pytest_pyfunc_call(pyfuncitem=self)

/usr/lib/python2.7/dist-packages/_pytest/python.py:1171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_pyfunc_call'>, args = ()
kwargs = {'pyfuncitem': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f140b120f50>
hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f140a086090>, <pluggy.HookImpl object at 0x7f140a028090>]
kwargs = {'pyfuncitem': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f140a086090>, <pluggy.HookImpl object at 0x7f140a028090>]
kwargs = {'pyfuncitem': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pyfuncitem = <Function 'test_bbox_inches_tight_suptile_legend[png]'>

@hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem):
testfunction = pyfuncitem.obj
if pyfuncitem._isyieldedfunction():
testfunction(*pyfuncitem._args)
else:
funcargs = pyfuncitem.funcargs
testargs = {}
for arg in pyfuncitem._fixtureinfo.argnames:
testargs[arg] = funcargs[arg]
> testfunction(**testargs)

/usr/lib/python2.7/dist-packages/_pytest/python.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expected = '/build/matplotlib-2.2.2/result_images/test_bbox_tight/bbox_inches_tight_suptile_legend-expected.png'
actual = '/build/matplotlib-2.2.2/result_images/test_bbox_tight/bbox_inches_tight_suptile_legend.png'
tol = 0.306, in_decorator = True

def compare_images(expected, actual, tol, in_decorator=False):
"""
Compare two "image" files checking differences within a tolerance.

The two given filenames may point to files which are convertible to
PNG via the `.converter` dictionary. The underlying RMS is calculated
with the `.calculate_rms` function.

Parameters
----------
expected : str
The filename of the expected image.
actual :str
The filename of the actual image.
tol : float
The tolerance (a color value difference, where 255 is the
maximal difference). The test fails if the average pixel
difference is greater than this value.
in_decorator : bool
If called from image_comparison decorator, this should be
True. (default=False)

Examples
--------
img1 = "./baseline/plot.png"
img2 = "./output/plot.png"
compare_images( img1, img2, 0.001 ):

"""
if not os.path.exists(actual):
raise Exception("Output image %s does not exist." % actual)

if os.stat(actual).st_size == 0:
raise Exception("Output image file %s is empty." % actual)

# Convert the image to png
extension = expected.split('.')[-1]

if not os.path.exists(expected):
raise IOError('Baseline image %r does not exist.' % expected)

if extension != 'png':
actual = convert(actual, False)
expected = convert(expected, True)

# open the image files and remove the alpha channel (if it exists)
expectedImage = _png.read_png_int(expected)
actualImage = _png.read_png_int(actual)
expectedImage = expectedImage[:, :, :3]
actualImage = actualImage[:, :, :3]

actualImage, expectedImage = crop_to_same(
actual, actualImage, expected, expectedImage)

diff_image = make_test_filename(actual, 'failed-diff')

if tol <= 0.0:
if np.array_equal(expectedImage, actualImage):
return None

# convert to signed integers, so that the images can be subtracted without
# overflow
expectedImage = expectedImage.astype(np.int16)
actualImage = actualImage.astype(np.int16)

> rms = calculate_rms(expectedImage, actualImage)

build/lib.linux-x86_64-2.7/matplotlib/testing/compare.py:439:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expectedImage = array([[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...55, 255, 255],
[255, 255, 255],
[255, 255, 255]]], dtype=int16)
actualImage = array([[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...55, 255, 255],
[255, 255, 255],
[255, 255, 255]]], dtype=int16)

def calculate_rms(expectedImage, actualImage):
"Calculate the per-pixel errors, then compute the root mean square error."
if expectedImage.shape != actualImage.shape:
raise ImageComparisonFailure(
"Image sizes do not match expected size: {0} "
> "actual size {1}".format(expectedImage.shape, actualImage.shape))
E ImageComparisonFailure: Image sizes do not match expected size: (593, 921, 3) actual size (592, 921, 3)

build/lib.linux-x86_64-2.7/matplotlib/testing/compare.py:369: ImageComparisonFailure
__________________ test_nose_image_comparison[failing figure] __________________

self = <CallInfo when='call' exception: assert '...' == 'FFF'
- ...
+ FFF>
func = <function <lambda> at 0x7f13fa2209b0>, when = 'call'

def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

> return CallInfo(lambda: ihook(item=item, **kwds), when=when)

/usr/lib/python2.7/dist-packages/_pytest/runner.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_runtest_call'>, args = ()
kwargs = {'item': <Function 'test_nose_image_comparison[failing figure]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f140b120f50>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f140a075a10>, <pluggy.HookImpl object at 0x7f1409fb5ad0>, <pluggy.HookImpl object at 0x7f1409fc27d0>]
kwargs = {'item': <Function 'test_nose_image_comparison[failing figure]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f140a075a10>, <pluggy.HookImpl object at 0x7f1409fb5ad0>, <pluggy.HookImpl object at 0x7f1409fc27d0>]
kwargs = {'item': <Function 'test_nose_image_comparison[failing figure]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <Function 'test_nose_image_comparison[failing figure]'>

def pytest_runtest_call(item):
_update_current_test_var(item, 'call')
try:
> item.runtest()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Function 'test_nose_image_comparison[failing figure]'>

def runtest(self):
""" execute the underlying test function. """
> self.ihook.pytest_pyfunc_call(pyfuncitem=self)

/usr/lib/python2.7/dist-packages/_pytest/python.py:1171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_pyfunc_call'>, args = ()
kwargs = {'pyfuncitem': <Function 'test_nose_image_comparison[failing figure]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f140b120f50>
hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f140a086090>, <pluggy.HookImpl object at 0x7f140a028090>]
kwargs = {'pyfuncitem': <Function 'test_nose_image_comparison[failing figure]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f140a086090>, <pluggy.HookImpl object at 0x7f140a028090>]
kwargs = {'pyfuncitem': <Function 'test_nose_image_comparison[failing figure]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pyfuncitem = <Function 'test_nose_image_comparison[failing figure]'>

@hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem):
testfunction = pyfuncitem.obj
if pyfuncitem._isyieldedfunction():
testfunction(*pyfuncitem._args)
else:
funcargs = pyfuncitem.funcargs
testargs = {}
for arg in pyfuncitem._fixtureinfo.argnames:
testargs[arg] = funcargs[arg]
> testfunction(**testargs)

/usr/lib/python2.7/dist-packages/_pytest/python.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

func = <function nosetest_simple_figure at 0x7f13fa4bc938>
kwargs = {'baseline_images': ['simple'], 'extensions': ['png', 'png', 'png']}
errors = []
failures = [(<class 'matplotlib.testing.exceptions.ImageComparisonFailure'>, 'images not close'), (<class 'matplotlib.testing.exc...onFailure'>, 'images not close'), (<class 'matplotlib.testing.exceptions.ImageComparisonFailure'>, 'images not close')]
dots = 'FFF'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch instance at 0x7f13fb26e128>

@pytest.mark.parametrize(
'func, kwargs, errors, failures, dots',
[
(nosetest_empty, {'baseline_images': []}, [], [], ''),
(nosetest_empty, {'baseline_images': ['foo']},
[(AssertionError,
'Test generated 0 images but there are 1 baseline images')],
[],
'E'),
(nosetest_simple_figure,
{'baseline_images': ['basn3p02'], 'extensions': ['png'],
'remove_text': True},
[],
[(ImageComparisonFailure, 'Image sizes do not match expected size:')],
'F'),
(nosetest_simple_figure,
{'baseline_images': ['simple']},
[],
[(ImageComparisonFailure, 'images not close')] * 3,
'FFF'),
(nosetest_simple_figure,
{'baseline_images': ['simple'], 'remove_text': True},
[],
[],
'...'),
(nosetest_manual_text_removal,
{'baseline_images': ['simple']},
[],
[],
'...'),
],
ids=[
'empty',
'extra baselines',
'incorrect shape',
'failing figure',
'passing figure',
'manual text removal',
])
def test_nose_image_comparison(func, kwargs, errors, failures, dots,
monkeypatch):
nose = pytest.importorskip('nose')
monkeypatch.setattr('matplotlib._called_from_pytest', False)

class TestResultVerifier(nose.result.TextTestResult):
def __init__(self, *args, **kwargs):
super(TestResultVerifier, self).__init__(*args, **kwargs)
self.error_count = 0
self.failure_count = 0

def addError(self, test, err):
super(TestResultVerifier, self).addError(test, err)

if self.error_count < len(errors):
assert err[0] is errors[self.error_count][0]
assert errors[self.error_count][1] in str(err[1])
else:
raise err[1]
self.error_count += 1

def addFailure(self, test, err):
super(TestResultVerifier, self).addFailure(test, err)

assert self.failure_count < len(failures), err[1]
assert err[0] is failures[self.failure_count][0]
assert failures[self.failure_count][1] in str(err[1])
self.failure_count += 1

# Make sure that multiple extensions work, but don't require LaTeX or
# Inkscape to do so.
kwargs.setdefault('extensions', ['png', 'png', 'png'])

func = image_comparison(**kwargs)(func)
loader = nose.loader.TestLoader()
suite = loader.loadTestsFromGenerator(
func,
'matplotlib.tests.test_compare_images')
if six.PY2:
output = io.BytesIO()
else:
output = io.StringIO()
result = TestResultVerifier(stream=output, descriptions=True, verbosity=1)
with warnings.catch_warnings():
# Nose uses deprecated stuff; we don't care about it.
warnings.simplefilter('ignore', DeprecationWarning)
suite.run(result=result)

> assert output.getvalue() == dots
E AssertionError: assert '...' == 'FFF'
E - ...
E + FFF

build/lib.linux-x86_64-2.7/matplotlib/tests/test_compare_images.py:199: AssertionError
----------------------------- Captured stdout call -----------------------------
images not close (RMS 12.955):
result_images/test_compare_images/simple.png
result_images/test_compare_images/simple-expected.png
images not close (RMS 12.955):
result_images/test_compare_images/simple.png
result_images/test_compare_images/simple-expected.png
images not close (RMS 12.955):
result_images/test_compare_images/simple.png
result_images/test_compare_images/simple-expected.png
------------------------------ Captured log call -------------------------------
importer.py 143 DEBUG Add path /build/matplotlib-2.2.2
suite.py 418 DEBUG Create suite for <function generate at 0x7f13fb0b9398>
suite.py 420 DEBUG tests <function generate at 0x7f13fb0b9398> context <function nosetest_simple_figure at 0x7f13fa4bc938>
suite.py 148 DEBUG Context suite for <function generate at 0x7f13fb0b9398> (<function nosetest_simple_figure at 0x7f13fa4bc938>) (139723701656336)
suite.py 481 DEBUG suite <nose.suite.ContextSuite context=nosetest_simple_figure> has context nosetest_simple_figure
suite.py 435 DEBUG get ancestry <function nosetest_simple_figure at 0x7f13fa4bc938>
suite.py 452 DEBUG <function nosetest_simple_figure at 0x7f13fa4bc938> ancestors ['matplotlib', 'tests', 'test_compare_images']
util.py 311 DEBUG __import__ matplotlib.tests.test_compare_images
util.py 320 DEBUG resolve: ['tests', 'test_compare_images'], matplotlib.tests.test_compare_images, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>
suite.py 485 DEBUG suite <nose.suite.ContextSuite context=nosetest_simple_figure> has ancestor matplotlib.tests.test_compare_images
suite.py 452 DEBUG <function nosetest_simple_figure at 0x7f13fa4bc938> ancestors ['matplotlib', 'tests']
util.py 311 DEBUG __import__ matplotlib.tests
util.py 320 DEBUG resolve: ['tests'], matplotlib.tests, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>
suite.py 485 DEBUG suite <nose.suite.ContextSuite context=nosetest_simple_figure> has ancestor matplotlib.tests
suite.py 452 DEBUG <function nosetest_simple_figure at 0x7f13fa4bc938> ancestors ['matplotlib']
util.py 311 DEBUG __import__ matplotlib
util.py 320 DEBUG resolve: [], matplotlib, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>
suite.py 485 DEBUG suite <nose.suite.ContextSuite context=nosetest_simple_figure> has ancestor matplotlib
suite.py 201 DEBUG suite 139723701656336 (<nose.suite.ContextSuite context=nosetest_simple_figure>) run called, tests: <generator object _get_wrapped_tests at 0x7f13f9f8eaf0>
suite.py 269 DEBUG suite 139723701656336 setUp called, tests: <generator object _get_wrapped_tests at 0x7f13fa3ce4b0>
suite.py 79 DEBUG tests in 139723701656336?
suite.py 288 DEBUG ancestor <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'> may need setup
suite.py 291 DEBUG ancestor <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'> does need setup
suite.py 302 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup context <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>
suite.py 288 DEBUG ancestor <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/__init__.py'> may need setup
suite.py 291 DEBUG ancestor <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/__init__.py'> does need setup
suite.py 302 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup context <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/__init__.py'>
util.py 470 DEBUG call fixture <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/__init__.py'>.setup
suite.py 288 DEBUG ancestor <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/test_compare_images.py'> may need setup
suite.py 291 DEBUG ancestor <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/test_compare_images.py'> does need setup
suite.py 302 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup context <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/test_compare_images.py'>
suite.py 288 DEBUG ancestor <function nosetest_simple_figure at 0x7f13fa4bc938> may need setup
suite.py 291 DEBUG ancestor <function nosetest_simple_figure at 0x7f13fa4bc938> does need setup
suite.py 302 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup context <function nosetest_simple_figure at 0x7f13fa4bc938>
util.py 470 DEBUG call fixture <function nosetest_simple_figure at 0x7f13fa4bc938>.setup
suite.py 298 DEBUG completed suite setup
suite.py 94 DEBUG precache is [matplotlib.tests.test_compare_images.nosetest_simple_figure(0, 'simple', 'png')]
suite.py 323 DEBUG context teardown
suite.py 341 DEBUG ancestor <function nosetest_simple_figure at 0x7f13fa4bc938> may need teardown
suite.py 349 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup ancestor <function nosetest_simple_figure at 0x7f13fa4bc938>
suite.py 356 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> teardown context <function nosetest_simple_figure at 0x7f13fa4bc938>
util.py 470 DEBUG call fixture <function nosetest_simple_figure at 0x7f13fa4bc938>.teardown
suite.py 341 DEBUG ancestor <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/test_compare_images.py'> may need teardown
suite.py 349 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup ancestor <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/test_compare_images.py'>
suite.py 356 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> teardown context <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/test_compare_images.py'>
suite.py 341 DEBUG ancestor <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/__init__.py'> may need teardown
suite.py 349 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup ancestor <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/__init__.py'>
suite.py 356 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> teardown context <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/tests/__init__.py'>
suite.py 341 DEBUG ancestor <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'> may need teardown
suite.py 349 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup ancestor <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>
suite.py 356 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> teardown context <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/__init__.py'>
suite.py 341 DEBUG ancestor <function nosetest_simple_figure at 0x7f13fa4bc938> may need teardown
suite.py 346 DEBUG ancestor <function nosetest_simple_figure at 0x7f13fa4bc938> already torn down
=============================== warnings summary ===============================
build/lib.linux-x86_64-2.7/matplotlib/tests/test_axes.py::test_fill_units[png]
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/axes/_base.py:2504: RuntimeWarning: invalid value encountered in double_scalars
delta = (x1t - x0t) * margin

build/lib.linux-x86_64-2.7/matplotlib/tests/test_axes.py::test_pyplot_axes
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/cbook/deprecation.py:107: MatplotlibDeprecationWarning: Using pyplot.axes(ax) with ax an Axes argument is deprecated. Please use pyplot.sca(ax) instead.
warnings.warn(message, mplDeprecation, stacklevel=1)

build/lib.linux-x86_64-2.7/matplotlib/tests/test_image.py::test_empty_imshow[make_norm2]
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/colors.py:1133: RuntimeWarning: invalid value encountered in greater
masked = np.abs(a) > self.linthresh

build/lib.linux-x86_64-2.7/matplotlib/tests/test_image.py::test_full_invalid
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/image.py:405: UserWarning: Warning: converting a masked element to nan.
dv = (np.float64(self.norm.vmax) -
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/image.py:406: UserWarning: Warning: converting a masked element to nan.
np.float64(self.norm.vmin))
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/image.py:412: UserWarning: Warning: converting a masked element to nan.
a_min = np.float64(newmin)
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/image.py:417: UserWarning: Warning: converting a masked element to nan.
a_max = np.float64(newmax)
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7/matplotlib/colors.py:916: UserWarning: Warning: converting a masked element to nan.
dtype = np.min_scalar_type(value)
/usr/lib/python2.7/dist-packages/numpy/ma/core.py:716: UserWarning: Warning: converting a masked element to nan.
data = np.array(a, copy=False, subok=subok)

-- Docs: http://doc.pytest.org/en/latest/warnings.html

python 2.7.15 debug flavor:

=================================== FAILURES ===================================
_______________ test_save_animation_smoketest[pillow-movie.gif] ________________

self = <CallInfo when='call' exception: list index out of range>
func = <function <lambda> at 0x7f4fd42b1e28>, when = 'call'

def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

> return CallInfo(lambda: ihook(item=item, **kwds), when=when)

/usr/lib/python2.7/dist-packages/_pytest/runner.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_runtest_call'>, args = ()
kwargs = {'item': <Function 'test_save_animation_smoketest[pillow-movie.gif]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f4fdcda3b50>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3a370>, <pluggy.HookImpl object at 0x7f4fdb93c530>, <pluggy.HookImpl object at 0x7f4fdb944bc0>]
kwargs = {'item': <Function 'test_save_animation_smoketest[pillow-movie.gif]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3a370>, <pluggy.HookImpl object at 0x7f4fdb93c530>, <pluggy.HookImpl object at 0x7f4fdb944bc0>]
kwargs = {'item': <Function 'test_save_animation_smoketest[pillow-movie.gif]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <Function 'test_save_animation_smoketest[pillow-movie.gif]'>

def pytest_runtest_call(item):
_update_current_test_var(item, 'call')
try:
> item.runtest()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Function 'test_save_animation_smoketest[pillow-movie.gif]'>

def runtest(self):
""" execute the underlying test function. """
> self.ihook.pytest_pyfunc_call(pyfuncitem=self)

/usr/lib/python2.7/dist-packages/_pytest/python.py:1171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_pyfunc_call'>, args = ()
kwargs = {'pyfuncitem': <Function 'test_save_animation_smoketest[pillow-movie.gif]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f4fdcda3b50>
hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3ae60>, <pluggy.HookImpl object at 0x7f4fdb9f7290>]
kwargs = {'pyfuncitem': <Function 'test_save_animation_smoketest[pillow-movie.gif]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3ae60>, <pluggy.HookImpl object at 0x7f4fdb9f7290>]
kwargs = {'pyfuncitem': <Function 'test_save_animation_smoketest[pillow-movie.gif]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pyfuncitem = <Function 'test_save_animation_smoketest[pillow-movie.gif]'>

@hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem):
testfunction = pyfuncitem.obj
if pyfuncitem._isyieldedfunction():
testfunction(*pyfuncitem._args)
else:
funcargs = pyfuncitem.funcargs
testargs = {}
for arg in pyfuncitem._fixtureinfo.argnames:
testargs[arg] = funcargs[arg]
> testfunction(**testargs)

/usr/lib/python2.7/dist-packages/_pytest/python.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tmpdir = local('/tmp/pytest-of-pbuilder/pytest-1/test_save_animation_smoketest_6')
writer = 'pillow', output = 'movie.gif'

@pytest.mark.parametrize('writer, output', WRITER_OUTPUT)
def test_save_animation_smoketest(tmpdir, writer, output):
try:
# for ImageMagick the rcparams must be patched to account for
# 'convert' being a built in MS tool, not the imagemagick
# tool.
writer._init_from_registry()
except AttributeError:
pass
if not animation.writers.is_available(writer):
pytest.skip("writer '%s' not available on this system" % writer)
fig, ax = plt.subplots()
line, = ax.plot([], [])

ax.set_xlim(0, 10)
ax.set_ylim(-1, 1)

dpi = None
codec = None
if writer == 'ffmpeg':
# Issue #8253
fig.set_size_inches((10.85, 9.21))
dpi = 100.
codec = 'h264'

def init():
line.set_data([], [])
return line,

def animate(i):
x = np.linspace(0, 10, 100)
y = np.sin(x + i)
line.set_data(x, y)
return line,

# Use temporary directory for the file-based writers, which produce a file
# per frame with known names.
with tmpdir.as_cwd():
anim = animation.FuncAnimation(fig, animate, init_func=init, frames=5)
try:
anim.save(output, fps=30, writer=writer, bitrate=500, dpi=dpi,
> codec=codec)

build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_animation.py:174:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <matplotlib.animation.FuncAnimation object at 0x7f4fcf6047d0>
filename = 'movie.gif'
writer = <matplotlib.animation.PillowWriter object at 0x7f4fcf604b50>, fps = 30
dpi = 100.0, codec = 'mpeg4', bitrate = 500, extra_args = None, metadata = None
extra_anim = None, savefig_kwargs = {}

def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
bitrate=None, extra_args=None, metadata=None, extra_anim=None,
savefig_kwargs=None):
'''Saves a movie file by drawing every frame.

Parameters
----------

filename : str
The output filename, e.g., :file:`mymovie.mp4`.

writer : :class:`MovieWriter` or str, optional
A `MovieWriter` instance to use or a key that identifies a
class to use, such as 'ffmpeg'. If ``None``, defaults to
:rc:`animation.writer`.

fps : number, optional
Frames per second in the movie. Defaults to ``None``, which will use
the animation's specified interval to set the frames per second.

dpi : number, optional
Controls the dots per inch for the movie frames. This combined with
the figure's size in inches controls the size of the movie. If
``None``, defaults to :rc:`savefig.dpi`.

codec : str, optional
The video codec to be used. Not all codecs are supported
by a given :class:`MovieWriter`. If ``None``, default to
:rc:`animation.codec`.

bitrate : number, optional
Specifies the number of bits used per second in the compressed
movie, in kilobits per second. A higher number means a higher
quality movie, but at the cost of increased file size. If ``None``,
defaults to :rc:`animation.bitrate`.

extra_args : list, optional
List of extra string arguments to be passed to the underlying movie
utility. If ``None``, defaults to :rc:`animation.extra_args`.

metadata : Dict[str, str], optional
Dictionary of keys and values for metadata to include in
the output file. Some keys that may be of use include:
title, artist, genre, subject, copyright, srcform, comment.

extra_anim : list, optional
Additional `Animation` objects that should be included
in the saved movie file. These need to be from the same
`matplotlib.figure.Figure` instance. Also, animation frames will
just be simply combined, so there should be a 1:1 correspondence
between the frames from the different animations.

savefig_kwargs : dict, optional
Is a dictionary containing keyword arguments to be passed
on to the `savefig` command which is called repeatedly to
save the individual frames.

Notes
-----
fps, codec, bitrate, extra_args, metadata are used to
construct a :class:`MovieWriter` instance and can only be
passed if `writer` is a string. If they are passed as
non-`None` and ``writer`` is a :class:`MovieWriter`, a
`RuntimeError` will be raised.

'''
# If the writer is None, use the rc param to find the name of the one
# to use
if writer is None:
writer = rcParams['animation.writer']
elif (not isinstance(writer, six.string_types) and
any(arg is not None
for arg in (fps, codec, bitrate, extra_args, metadata))):
raise RuntimeError('Passing in values for arguments '
'fps, codec, bitrate, extra_args, or metadata '
'is not supported when writer is an existing '
'MovieWriter instance. These should instead be '
'passed as arguments when creating the '
'MovieWriter instance.')

if savefig_kwargs is None:
savefig_kwargs = {}

# Need to disconnect the first draw callback, since we'll be doing
# draws. Otherwise, we'll end up starting the animation.
if self._first_draw_id is not None:
self._fig.canvas.mpl_disconnect(self._first_draw_id)
reconnect_first_draw = True
else:
reconnect_first_draw = False

if fps is None and hasattr(self, '_interval'):
# Convert interval in ms to frames per second
fps = 1000. / self._interval

# Re-use the savefig DPI for ours if none is given
if dpi is None:
dpi = rcParams['savefig.dpi']
if dpi == 'figure':
dpi = self._fig.dpi

if codec is None:
codec = rcParams['animation.codec']

if bitrate is None:
bitrate = rcParams['animation.bitrate']

all_anim = [self]
if extra_anim is not None:
all_anim.extend(anim
for anim
in extra_anim if anim._fig is self._fig)

# If we have the name of a writer, instantiate an instance of the
# registered class.
if isinstance(writer, six.string_types):
if writer in writers.avail:
writer = writers[writer](fps, codec, bitrate,
extra_args=extra_args,
metadata=metadata)
else:
_log.warning("MovieWriter %s unavailable.", writer)

try:
writer = writers[writers.list()[0]](fps, codec, bitrate,
extra_args=extra_args,
metadata=metadata)
except IndexError:
raise ValueError("Cannot save animation: no writers are "
"available. Please install ffmpeg to "
"save animations.")
_log.info('Animation.save using %s', type(writer))

if 'bbox_inches' in savefig_kwargs:
_log.warning("Warning: discarding the 'bbox_inches' argument in "
"'savefig_kwargs' as it may cause frame size "
"to vary, which is inappropriate for animation.")
savefig_kwargs.pop('bbox_inches')

# Create a new sequence of frames for saved data. This is different
# from new_frame_seq() to give the ability to save 'live' generated
# frame information to be saved later.
# TODO: Right now, after closing the figure, saving a movie won't work
# since GUI widgets are gone. Either need to remove extra code to
# allow for this non-existent use case or find a way to make it work.
with rc_context():
if rcParams['savefig.bbox'] == 'tight':
_log.info("Disabling savefig.bbox = 'tight', as it may cause "
"frame size to vary, which is inappropriate for "
"animation.")
rcParams['savefig.bbox'] = None
with writer.saving(self._fig, filename, dpi):
for anim in all_anim:
# Clear the initial frame
anim._init_draw()
for data in zip(*[a.new_saved_frame_seq() for a in all_anim]):
for anim, d in zip(all_anim, data):
# TODO: See if turning off blit is really necessary
anim._draw_next_frame(d, blit=False)
> writer.grab_frame(**savefig_kwargs)

build/lib.linux-x86_64-2.7-pydebug/matplotlib/animation.py:1200:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <contextlib.GeneratorContextManager object at 0x7f4fcf604ca0>
type = <type 'exceptions.ImportError'>
value = ImportError('/usr/lib/python2.7/dist-packages/PIL/_imaging.x86_64-linux-gnu.so: undefined symbol: Py_InitModule4_64',)
traceback = <traceback object at 0x7f4fcf4b8588>

def __exit__(self, type, value, traceback):
if type is None:
try:
self.gen.next()
except StopIteration:
return
else:
raise RuntimeError("generator didn't stop")
else:
if value is None:
# Need to force instantiation so we can reliably
# tell if we get the same exception back
value = type()
try:
> self.gen.throw(type, value, traceback)

/usr/lib/python2.7/contextlib.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <matplotlib.animation.PillowWriter object at 0x7f4fcf604b50>
fig = <Figure size 640x480 with 1 Axes>, outfile = 'movie.gif', dpi = 100.0
args = (), kwargs = {}

@contextlib.contextmanager
def saving(self, fig, outfile, dpi, *args, **kwargs):
'''
Context manager to facilitate writing the movie file.

``*args, **kw`` are any parameters that should be passed to `setup`.
'''
# This particular sequence is what contextlib.contextmanager wants
self.setup(fig, outfile, dpi, *args, **kwargs)
try:
yield self
finally:
> self.finish()

build/lib.linux-x86_64-2.7-pydebug/matplotlib/animation.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <matplotlib.animation.PillowWriter object at 0x7f4fcf604b50>

def finish(self):
> self._frames[0].save(
self._outfile, save_all=True, append_images=self._frames[1:],
duration=int(1000 / self.fps))
E IndexError: list index out of range

build/lib.linux-x86_64-2.7-pydebug/matplotlib/animation.py:610: IndexError
------------------------------ Captured log call -------------------------------
animation.py 1172 INFO Animation.save using <class 'matplotlib.animation.PillowWriter'>
_____________________________ test_log_scales[png] _____________________________

self = <CallInfo when='call' exception: Image sizes do not match expected size: (600, 800, 3) actual size (600, 800, 4)>
func = <function <lambda> at 0x7f4fd446c258>, when = 'call'

def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

> return CallInfo(lambda: ihook(item=item, **kwds), when=when)

/usr/lib/python2.7/dist-packages/_pytest/runner.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_runtest_call'>, args = ()
kwargs = {'item': <Function 'test_log_scales[png]'>}, notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f4fdcda3b50>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3a370>, <pluggy.HookImpl object at 0x7f4fdb93c530>, <pluggy.HookImpl object at 0x7f4fdb944bc0>]
kwargs = {'item': <Function 'test_log_scales[png]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3a370>, <pluggy.HookImpl object at 0x7f4fdb93c530>, <pluggy.HookImpl object at 0x7f4fdb944bc0>]
kwargs = {'item': <Function 'test_log_scales[png]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <Function 'test_log_scales[png]'>

def pytest_runtest_call(item):
_update_current_test_var(item, 'call')
try:
> item.runtest()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Function 'test_log_scales[png]'>

def runtest(self):
""" execute the underlying test function. """
> self.ihook.pytest_pyfunc_call(pyfuncitem=self)

/usr/lib/python2.7/dist-packages/_pytest/python.py:1171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_pyfunc_call'>, args = ()
kwargs = {'pyfuncitem': <Function 'test_log_scales[png]'>}, notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f4fdcda3b50>
hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3ae60>, <pluggy.HookImpl object at 0x7f4fdb9f7290>]
kwargs = {'pyfuncitem': <Function 'test_log_scales[png]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3ae60>, <pluggy.HookImpl object at 0x7f4fdb9f7290>]
kwargs = {'pyfuncitem': <Function 'test_log_scales[png]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pyfuncitem = <Function 'test_log_scales[png]'>

@hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem):
testfunction = pyfuncitem.obj
if pyfuncitem._isyieldedfunction():
testfunction(*pyfuncitem._args)
else:
funcargs = pyfuncitem.funcargs
testargs = {}
for arg in pyfuncitem._fixtureinfo.argnames:
testargs[arg] = funcargs[arg]
> testfunction(**testargs)

/usr/lib/python2.7/dist-packages/_pytest/python.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expected = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales-expected.png'
actual = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales.png'
tol = 0.306, in_decorator = True

def compare_images(expected, actual, tol, in_decorator=False):
"""
Compare two "image" files checking differences within a tolerance.

The two given filenames may point to files which are convertible to
PNG via the `.converter` dictionary. The underlying RMS is calculated
with the `.calculate_rms` function.

Parameters
----------
expected : str
The filename of the expected image.
actual :str
The filename of the actual image.
tol : float
The tolerance (a color value difference, where 255 is the
maximal difference). The test fails if the average pixel
difference is greater than this value.
in_decorator : bool
If called from image_comparison decorator, this should be
True. (default=False)

Examples
--------
img1 = "./baseline/plot.png"
img2 = "./output/plot.png"
compare_images( img1, img2, 0.001 ):

"""
if not os.path.exists(actual):
raise Exception("Output image %s does not exist." % actual)

if os.stat(actual).st_size == 0:
raise Exception("Output image file %s is empty." % actual)

# Convert the image to png
extension = expected.split('.')[-1]

if not os.path.exists(expected):
raise IOError('Baseline image %r does not exist.' % expected)

if extension != 'png':
actual = convert(actual, False)
expected = convert(expected, True)

# open the image files and remove the alpha channel (if it exists)
expectedImage = _png.read_png_int(expected)
actualImage = _png.read_png_int(actual)
expectedImage = expectedImage[:, :, :3]
actualImage = actualImage[:, :, :3]

actualImage, expectedImage = crop_to_same(
actual, actualImage, expected, expectedImage)

diff_image = make_test_filename(actual, 'failed-diff')

if tol <= 0.0:
if np.array_equal(expectedImage, actualImage):
return None

# convert to signed integers, so that the images can be subtracted without
# overflow
expectedImage = expectedImage.astype(np.int16)
actualImage = actualImage.astype(np.int16)

rms = calculate_rms(expectedImage, actualImage)

if rms <= tol:
return None

> save_diff_image(expected, actual, diff_image)

build/lib.linux-x86_64-2.7-pydebug/matplotlib/testing/compare.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expected = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales-expected.png'
actual = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales.png'
output = '/build/matplotlib-2.2.2/result_images/test_axes/log_scales-failed-diff.png'

def save_diff_image(expected, actual, output):
expectedImage = _png.read_png(expected)
actualImage = _png.read_png(actual)
actualImage, expectedImage = crop_to_same(
actual, actualImage, expected, expectedImage)
expectedImage = np.array(expectedImage).astype(float)
actualImage = np.array(actualImage).astype(float)
if expectedImage.shape != actualImage.shape:
raise ImageComparisonFailure(
"Image sizes do not match expected size: {0} "
> "actual size {1}".format(expectedImage.shape, actualImage.shape))
E ImageComparisonFailure: Image sizes do not match expected size: (600, 800, 3) actual size (600, 800, 4)

build/lib.linux-x86_64-2.7-pydebug/matplotlib/testing/compare.py:471: ImageComparisonFailure
__________________ test_bbox_inches_tight_suptile_legend[png] __________________

self = <CallInfo when='call' exception: Image sizes do not match expected size: (593, 921, 3) actual size (592, 921, 3)>
func = <function <lambda> at 0x7f4fd3bdf1b0>, when = 'call'

def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

> return CallInfo(lambda: ihook(item=item, **kwds), when=when)

/usr/lib/python2.7/dist-packages/_pytest/runner.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_runtest_call'>, args = ()
kwargs = {'item': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f4fdcda3b50>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3a370>, <pluggy.HookImpl object at 0x7f4fdb93c530>, <pluggy.HookImpl object at 0x7f4fdb944bc0>]
kwargs = {'item': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3a370>, <pluggy.HookImpl object at 0x7f4fdb93c530>, <pluggy.HookImpl object at 0x7f4fdb944bc0>]
kwargs = {'item': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <Function 'test_bbox_inches_tight_suptile_legend[png]'>

def pytest_runtest_call(item):
_update_current_test_var(item, 'call')
try:
> item.runtest()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Function 'test_bbox_inches_tight_suptile_legend[png]'>

def runtest(self):
""" execute the underlying test function. """
> self.ihook.pytest_pyfunc_call(pyfuncitem=self)

/usr/lib/python2.7/dist-packages/_pytest/python.py:1171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_pyfunc_call'>, args = ()
kwargs = {'pyfuncitem': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f4fdcda3b50>
hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3ae60>, <pluggy.HookImpl object at 0x7f4fdb9f7290>]
kwargs = {'pyfuncitem': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3ae60>, <pluggy.HookImpl object at 0x7f4fdb9f7290>]
kwargs = {'pyfuncitem': <Function 'test_bbox_inches_tight_suptile_legend[png]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pyfuncitem = <Function 'test_bbox_inches_tight_suptile_legend[png]'>

@hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem):
testfunction = pyfuncitem.obj
if pyfuncitem._isyieldedfunction():
testfunction(*pyfuncitem._args)
else:
funcargs = pyfuncitem.funcargs
testargs = {}
for arg in pyfuncitem._fixtureinfo.argnames:
testargs[arg] = funcargs[arg]
> testfunction(**testargs)

/usr/lib/python2.7/dist-packages/_pytest/python.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expected = '/build/matplotlib-2.2.2/result_images/test_bbox_tight/bbox_inches_tight_suptile_legend-expected.png'
actual = '/build/matplotlib-2.2.2/result_images/test_bbox_tight/bbox_inches_tight_suptile_legend.png'
tol = 0.306, in_decorator = True

def compare_images(expected, actual, tol, in_decorator=False):
"""
Compare two "image" files checking differences within a tolerance.

The two given filenames may point to files which are convertible to
PNG via the `.converter` dictionary. The underlying RMS is calculated
with the `.calculate_rms` function.

Parameters
----------
expected : str
The filename of the expected image.
actual :str
The filename of the actual image.
tol : float
The tolerance (a color value difference, where 255 is the
maximal difference). The test fails if the average pixel
difference is greater than this value.
in_decorator : bool
If called from image_comparison decorator, this should be
True. (default=False)

Examples
--------
img1 = "./baseline/plot.png"
img2 = "./output/plot.png"
compare_images( img1, img2, 0.001 ):

"""
if not os.path.exists(actual):
raise Exception("Output image %s does not exist." % actual)

if os.stat(actual).st_size == 0:
raise Exception("Output image file %s is empty." % actual)

# Convert the image to png
extension = expected.split('.')[-1]

if not os.path.exists(expected):
raise IOError('Baseline image %r does not exist.' % expected)

if extension != 'png':
actual = convert(actual, False)
expected = convert(expected, True)

# open the image files and remove the alpha channel (if it exists)
expectedImage = _png.read_png_int(expected)
actualImage = _png.read_png_int(actual)
expectedImage = expectedImage[:, :, :3]
actualImage = actualImage[:, :, :3]

actualImage, expectedImage = crop_to_same(
actual, actualImage, expected, expectedImage)

diff_image = make_test_filename(actual, 'failed-diff')

if tol <= 0.0:
if np.array_equal(expectedImage, actualImage):
return None

# convert to signed integers, so that the images can be subtracted without
# overflow
expectedImage = expectedImage.astype(np.int16)
actualImage = actualImage.astype(np.int16)

> rms = calculate_rms(expectedImage, actualImage)

build/lib.linux-x86_64-2.7-pydebug/matplotlib/testing/compare.py:439:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expectedImage = array([[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...55, 255, 255],
[255, 255, 255],
[255, 255, 255]]], dtype=int16)
actualImage = array([[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...55, 255, 255],
[255, 255, 255],
[255, 255, 255]]], dtype=int16)

def calculate_rms(expectedImage, actualImage):
"Calculate the per-pixel errors, then compute the root mean square error."
if expectedImage.shape != actualImage.shape:
raise ImageComparisonFailure(
"Image sizes do not match expected size: {0} "
> "actual size {1}".format(expectedImage.shape, actualImage.shape))
E ImageComparisonFailure: Image sizes do not match expected size: (593, 921, 3) actual size (592, 921, 3)

build/lib.linux-x86_64-2.7-pydebug/matplotlib/testing/compare.py:369: ImageComparisonFailure
__________________ test_nose_image_comparison[failing figure] __________________

self = <CallInfo when='call' exception: assert '...' == 'FFF'
- ...
+ FFF>
func = <function <lambda> at 0x7f4fd45b0a38>, when = 'call'

def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

> return CallInfo(lambda: ihook(item=item, **kwds), when=when)

/usr/lib/python2.7/dist-packages/_pytest/runner.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_runtest_call'>, args = ()
kwargs = {'item': <Function 'test_nose_image_comparison[failing figure]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f4fdcda3b50>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3a370>, <pluggy.HookImpl object at 0x7f4fdb93c530>, <pluggy.HookImpl object at 0x7f4fdb944bc0>]
kwargs = {'item': <Function 'test_nose_image_comparison[failing figure]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_runtest_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3a370>, <pluggy.HookImpl object at 0x7f4fdb93c530>, <pluggy.HookImpl object at 0x7f4fdb944bc0>]
kwargs = {'item': <Function 'test_nose_image_comparison[failing figure]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <Function 'test_nose_image_comparison[failing figure]'>

def pytest_runtest_call(item):
_update_current_test_var(item, 'call')
try:
> item.runtest()

/usr/lib/python2.7/dist-packages/_pytest/runner.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Function 'test_nose_image_comparison[failing figure]'>

def runtest(self):
""" execute the underlying test function. """
> self.ihook.pytest_pyfunc_call(pyfuncitem=self)

/usr/lib/python2.7/dist-packages/_pytest/python.py:1171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_pyfunc_call'>, args = ()
kwargs = {'pyfuncitem': <Function 'test_nose_image_comparison[failing figure]'>}
notincall = set([])

def __call__(self, *args, **kwargs):
if args:
raise TypeError("hook calling supports only keyword arguments")
assert not self.is_historic()
if self.argnames:
notincall = set(self.argnames) - set(['__multicall__']) - set(
kwargs.keys())
if notincall:
warnings.warn(
"Argument(s) {} which are declared in the hookspec "
"can not be found in this hook call"
.format(tuple(notincall)),
stacklevel=2,
)
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:617:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f4fdcda3b50>
hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3ae60>, <pluggy.HookImpl object at 0x7f4fdb9f7290>]
kwargs = {'pyfuncitem': <Function 'test_nose_image_comparison[failing figure]'>}

def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_pyfunc_call'>
methods = [<pluggy.HookImpl object at 0x7f4fdba3ae60>, <pluggy.HookImpl object at 0x7f4fdb9f7290>]
kwargs = {'pyfuncitem': <Function 'test_nose_image_comparison[failing figure]'>}

self._inner_hookexec = lambda hook, methods, kwargs: \
hook.multicall(
methods, kwargs,
> firstresult=hook.spec_opts.get('firstresult'),
)

/usr/lib/python2.7/dist-packages/pluggy/__init__.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pyfuncitem = <Function 'test_nose_image_comparison[failing figure]'>

@hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem):
testfunction = pyfuncitem.obj
if pyfuncitem._isyieldedfunction():
testfunction(*pyfuncitem._args)
else:
funcargs = pyfuncitem.funcargs
testargs = {}
for arg in pyfuncitem._fixtureinfo.argnames:
testargs[arg] = funcargs[arg]
> testfunction(**testargs)

/usr/lib/python2.7/dist-packages/_pytest/python.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

func = <function nosetest_simple_figure at 0x7f4fd4d83ae0>
kwargs = {'baseline_images': ['simple'], 'extensions': ['png', 'png', 'png']}
errors = []
failures = [(<class 'matplotlib.testing.exceptions.ImageComparisonFailure'>, 'images not close'), (<class 'matplotlib.testing.exc...onFailure'>, 'images not close'), (<class 'matplotlib.testing.exceptions.ImageComparisonFailure'>, 'images not close')]
dots = 'FFF'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch instance at 0x7f4fd5651420>

@pytest.mark.parametrize(
'func, kwargs, errors, failures, dots',
[
(nosetest_empty, {'baseline_images': []}, [], [], ''),
(nosetest_empty, {'baseline_images': ['foo']},
[(AssertionError,
'Test generated 0 images but there are 1 baseline images')],
[],
'E'),
(nosetest_simple_figure,
{'baseline_images': ['basn3p02'], 'extensions': ['png'],
'remove_text': True},
[],
[(ImageComparisonFailure, 'Image sizes do not match expected size:')],
'F'),
(nosetest_simple_figure,
{'baseline_images': ['simple']},
[],
[(ImageComparisonFailure, 'images not close')] * 3,
'FFF'),
(nosetest_simple_figure,
{'baseline_images': ['simple'], 'remove_text': True},
[],
[],
'...'),
(nosetest_manual_text_removal,
{'baseline_images': ['simple']},
[],
[],
'...'),
],
ids=[
'empty',
'extra baselines',
'incorrect shape',
'failing figure',
'passing figure',
'manual text removal',
])
def test_nose_image_comparison(func, kwargs, errors, failures, dots,
monkeypatch):
nose = pytest.importorskip('nose')
monkeypatch.setattr('matplotlib._called_from_pytest', False)

class TestResultVerifier(nose.result.TextTestResult):
def __init__(self, *args, **kwargs):
super(TestResultVerifier, self).__init__(*args, **kwargs)
self.error_count = 0
self.failure_count = 0

def addError(self, test, err):
super(TestResultVerifier, self).addError(test, err)

if self.error_count < len(errors):
assert err[0] is errors[self.error_count][0]
assert errors[self.error_count][1] in str(err[1])
else:
raise err[1]
self.error_count += 1

def addFailure(self, test, err):
super(TestResultVerifier, self).addFailure(test, err)

assert self.failure_count < len(failures), err[1]
assert err[0] is failures[self.failure_count][0]
assert failures[self.failure_count][1] in str(err[1])
self.failure_count += 1

# Make sure that multiple extensions work, but don't require LaTeX or
# Inkscape to do so.
kwargs.setdefault('extensions', ['png', 'png', 'png'])

func = image_comparison(**kwargs)(func)
loader = nose.loader.TestLoader()
suite = loader.loadTestsFromGenerator(
func,
'matplotlib.tests.test_compare_images')
if six.PY2:
output = io.BytesIO()
else:
output = io.StringIO()
result = TestResultVerifier(stream=output, descriptions=True, verbosity=1)
with warnings.catch_warnings():
# Nose uses deprecated stuff; we don't care about it.
warnings.simplefilter('ignore', DeprecationWarning)
suite.run(result=result)

> assert output.getvalue() == dots
E AssertionError: assert '...' == 'FFF'
E - ...
E + FFF

build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_compare_images.py:199: AssertionError
----------------------------- Captured stdout call -----------------------------
images not close (RMS 12.955):
result_images/test_compare_images/simple.png
result_images/test_compare_images/simple-expected.png
images not close (RMS 12.955):
result_images/test_compare_images/simple.png
result_images/test_compare_images/simple-expected.png
images not close (RMS 12.955):
result_images/test_compare_images/simple.png
result_images/test_compare_images/simple-expected.png
------------------------------ Captured log call -------------------------------
importer.py 143 DEBUG Add path /build/matplotlib-2.2.2
suite.py 418 DEBUG Create suite for <function generate at 0x7f4fd49e3d80>
suite.py 420 DEBUG tests <function generate at 0x7f4fd49e3d80> context <function nosetest_simple_figure at 0x7f4fd4d83ae0>
suite.py 148 DEBUG Context suite for <function generate at 0x7f4fd49e3d80> (<function nosetest_simple_figure at 0x7f4fd4d83ae0>) (139980834420128)
suite.py 481 DEBUG suite <nose.suite.ContextSuite context=nosetest_simple_figure> has context nosetest_simple_figure
suite.py 435 DEBUG get ancestry <function nosetest_simple_figure at 0x7f4fd4d83ae0>
suite.py 452 DEBUG <function nosetest_simple_figure at 0x7f4fd4d83ae0> ancestors ['matplotlib', 'tests', 'test_compare_images']
util.py 311 DEBUG __import__ matplotlib.tests.test_compare_images
util.py 320 DEBUG resolve: ['tests', 'test_compare_images'], matplotlib.tests.test_compare_images, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>
suite.py 485 DEBUG suite <nose.suite.ContextSuite context=nosetest_simple_figure> has ancestor matplotlib.tests.test_compare_images
suite.py 452 DEBUG <function nosetest_simple_figure at 0x7f4fd4d83ae0> ancestors ['matplotlib', 'tests']
util.py 311 DEBUG __import__ matplotlib.tests
util.py 320 DEBUG resolve: ['tests'], matplotlib.tests, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>
suite.py 485 DEBUG suite <nose.suite.ContextSuite context=nosetest_simple_figure> has ancestor matplotlib.tests
suite.py 452 DEBUG <function nosetest_simple_figure at 0x7f4fd4d83ae0> ancestors ['matplotlib']
util.py 311 DEBUG __import__ matplotlib
util.py 320 DEBUG resolve: [], matplotlib, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>, <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>
suite.py 485 DEBUG suite <nose.suite.ContextSuite context=nosetest_simple_figure> has ancestor matplotlib
suite.py 201 DEBUG suite 139980834420128 (<nose.suite.ContextSuite context=nosetest_simple_figure>) run called, tests: <generator object _get_wrapped_tests at 0x7f4fd5629ce0>
suite.py 269 DEBUG suite 139980834420128 setUp called, tests: <generator object _get_wrapped_tests at 0x7f4fd3a837e0>
suite.py 79 DEBUG tests in 139980834420128?
suite.py 288 DEBUG ancestor <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'> may need setup
suite.py 291 DEBUG ancestor <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'> does need setup
suite.py 302 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup context <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>
suite.py 288 DEBUG ancestor <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/__init__.py'> may need setup
suite.py 291 DEBUG ancestor <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/__init__.py'> does need setup
suite.py 302 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup context <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/__init__.py'>
util.py 470 DEBUG call fixture <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/__init__.py'>.setup
suite.py 288 DEBUG ancestor <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_compare_images.py'> may need setup
suite.py 291 DEBUG ancestor <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_compare_images.py'> does need setup
suite.py 302 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup context <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_compare_images.py'>
suite.py 288 DEBUG ancestor <function nosetest_simple_figure at 0x7f4fd4d83ae0> may need setup
suite.py 291 DEBUG ancestor <function nosetest_simple_figure at 0x7f4fd4d83ae0> does need setup
suite.py 302 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup context <function nosetest_simple_figure at 0x7f4fd4d83ae0>
util.py 470 DEBUG call fixture <function nosetest_simple_figure at 0x7f4fd4d83ae0>.setup
suite.py 298 DEBUG completed suite setup
suite.py 94 DEBUG precache is [matplotlib.tests.test_compare_images.nosetest_simple_figure(0, 'simple', 'png')]
suite.py 323 DEBUG context teardown
suite.py 341 DEBUG ancestor <function nosetest_simple_figure at 0x7f4fd4d83ae0> may need teardown
suite.py 349 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup ancestor <function nosetest_simple_figure at 0x7f4fd4d83ae0>
suite.py 356 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> teardown context <function nosetest_simple_figure at 0x7f4fd4d83ae0>
util.py 470 DEBUG call fixture <function nosetest_simple_figure at 0x7f4fd4d83ae0>.teardown
suite.py 341 DEBUG ancestor <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_compare_images.py'> may need teardown
suite.py 349 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup ancestor <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_compare_images.py'>
suite.py 356 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> teardown context <module 'matplotlib.tests.test_compare_images' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_compare_images.py'>
suite.py 341 DEBUG ancestor <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/__init__.py'> may need teardown
suite.py 349 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup ancestor <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/__init__.py'>
suite.py 356 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> teardown context <module 'matplotlib.tests' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/__init__.py'>
suite.py 341 DEBUG ancestor <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'> may need teardown
suite.py 349 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> setup ancestor <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>
suite.py 356 DEBUG <nose.suite.ContextSuite context=nosetest_simple_figure> teardown context <module 'matplotlib' from '/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/__init__.py'>
suite.py 341 DEBUG ancestor <function nosetest_simple_figure at 0x7f4fd4d83ae0> may need teardown
suite.py 346 DEBUG ancestor <function nosetest_simple_figure at 0x7f4fd4d83ae0> already torn down
=============================== warnings summary ===============================
build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_axes.py::test_fill_units[png]
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/axes/_base.py:2504: RuntimeWarning: invalid value encountered in double_scalars
delta = (x1t - x0t) * margin

build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_axes.py::test_pyplot_axes
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/cbook/deprecation.py:107: MatplotlibDeprecationWarning: Using pyplot.axes(ax) with ax an Axes argument is deprecated. Please use pyplot.sca(ax) instead.
warnings.warn(message, mplDeprecation, stacklevel=1)

build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_image.py::test_empty_imshow[make_norm2]
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/colors.py:1133: RuntimeWarning: invalid value encountered in greater
masked = np.abs(a) > self.linthresh

build/lib.linux-x86_64-2.7-pydebug/matplotlib/tests/test_image.py::test_full_invalid
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/image.py:405: UserWarning: Warning: converting a masked element to nan.
dv = (np.float64(self.norm.vmax) -
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/image.py:406: UserWarning: Warning: converting a masked element to nan.
np.float64(self.norm.vmin))
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/image.py:412: UserWarning: Warning: converting a masked element to nan.
a_min = np.float64(newmin)
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/image.py:417: UserWarning: Warning: converting a masked element to nan.
a_max = np.float64(newmax)
/build/matplotlib-2.2.2/build/lib.linux-x86_64-2.7-pydebug/matplotlib/colors.py:916: UserWarning: Warning: converting a masked element to nan.
dtype = np.min_scalar_type(value)
/usr/lib/python2.7/dist-packages/numpy/ma/core.py:716: UserWarning: Warning: converting a masked element to nan.
data = np.array(a, copy=False, subok=subok)

-- Docs: http://doc.pytest.org/en/latest/warnings.html

python 3.6.5

ERROR collecting build/lib.linux-x86_64-3.6/mpl_toolkits/tests/test_axisartist_angle_helper.py
/usr/lib/python3/dist-packages/_pytest/python.py:403: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python3/dist-packages/py/_path/local.py:668: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:971: in _find_and_load
???
<frozen importlib._bootstrap>:955: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:656: in _load_unlocked
???
<frozen importlib._bootstrap>:626: in _load_backward_compatible
???
/usr/lib/python3/dist-packages/_pytest/assertion/rewrite.py:213: in load_module
py.builtin.exec_(co, mod.__dict__)
build/lib.linux-x86_64-3.6/mpl_toolkits/tests/test_axisartist_angle_helper.py:9: in <module>
from mpl_toolkits.axisartist.angle_helper import (
E File "/build/matplotlib-2.2.2/build/lib.linux-x86_64-3.6/mpl_toolkits/axisartist/angle_helper.py", line 212
E deg_mark = "^{\circ}"
E ^
E SyntaxError: invalid escape sequence \c
ERROR collecting build/lib.linux-x86_64-3.6/mpl_toolkits/tests/test_axisartist_floating_axes.py
/usr/lib/python3/dist-packages/_pytest/python.py:403: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python3/dist-packages/py/_path/local.py:668: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:971: in _find_and_load
???
<frozen importlib._bootstrap>:955: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:656: in _load_unlocked
???
<frozen importlib._bootstrap>:626: in _load_backward_compatible
???
/usr/lib/python3/dist-packages/_pytest/assertion/rewrite.py:213: in load_module
py.builtin.exec_(co, mod.__dict__)
build/lib.linux-x86_64-3.6/mpl_toolkits/tests/test_axisartist_floating_axes.py:15: in <module>
from mpl_toolkits.axisartist import angle_helper
E File "/build/matplotlib-2.2.2/build/lib.linux-x86_64-3.6/mpl_toolkits/axisartist/angle_helper.py", line 212
E deg_mark = "^{\circ}"
E ^
E SyntaxError: invalid escape sequence \c
ERROR collecting build/lib.linux-x86_64-3.6/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py
/usr/lib/python3/dist-packages/_pytest/python.py:403: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python3/dist-packages/py/_path/local.py:668: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:971: in _find_and_load
???
<frozen importlib._bootstrap>:955: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:656: in _load_unlocked
???
<frozen importlib._bootstrap>:626: in _load_backward_compatible
???
/usr/lib/python3/dist-packages/_pytest/assertion/rewrite.py:213: in load_module
py.builtin.exec_(co, mod.__dict__)
build/lib.linux-x86_64-3.6/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py:15: in <module>
from mpl_toolkits.axisartist import angle_helper
E File "/build/matplotlib-2.2.2/build/lib.linux-x86_64-3.6/mpl_toolkits/axisartist/angle_helper.py", line 212
E deg_mark = "^{\circ}"
E ^
E SyntaxError: invalid escape sequence \c
------------------------------- Captured stderr --------------------------------
/build/matplotlib-2.2.2/build/lib.linux-x86_64-3.6/matplotlib/cbook/deprecation.py:107: MatplotlibDeprecationWarning: The mpl_toolkits.axes_grid module was deprecated in version 2.1. Use mpl_toolkits.axes_grid1 and mpl_toolkits.axisartist provies the same functionality instead.
warnings.warn(message, mplDeprecation, stacklevel=1)
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!

Issue 2:
python3.5.1

matplotlib 1.5.1

jupyter 4.0.6

matplotlib.pyplot cannot render figures with new colormaps in discretized mode ('viridis' and friends).

with 'jet' and friends exception is not raised

How to reproduce:

import matplotlib.pyplot as plt
import numpy as np
a = np.random.randn(20,20)
cmap = plt.get_cmap('viridis',20)
plt.pcolormesh(a,cmap=cmap)

raises:

<matplotlib.collections.QuadMesh at 0x11a767198>

In [6]: Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 368, in to_rgba
'length of rgba sequence should be either 3 or 4')
ValueError: length of rgba sequence should be either 3 or 4

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 399, in to_rgba_array
return np.array([self.to_rgba(c, alpha)], dtype=np.float)
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 376, in to_rgba
'to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgba: Invalid rgba arg "['viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis', 'viridis']"
length of rgba sequence should be either 3 or 4

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 306, in to_rgb
fl = float(argl)
ValueError: could not convert string to float: 'viridis'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 370, in to_rgba
r, g, b = self.to_rgb(arg)
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 328, in to_rgb
'to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgb: Invalid rgb arg "viridis"
could not convert string to float: 'viridis'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 1549, in __call__
return self.func(*args)
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 596, in callit
func(*args)
File "/usr/local/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 373, in idle_draw
self.draw()
File "/usr/local/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 354, in draw
FigureCanvasAgg.draw(self)
File "/usr/local/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py", line 474, in draw
self.figure.draw(self.renderer)
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/matplotlib/figure.py", line 1159, in draw
func(*args)
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/matplotlib/axes/_base.py", line 2324, in draw
a.draw(renderer)
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/matplotlib/collections.py", line 1847, in draw
self.update_scalarmappable()
File "/usr/local/lib/python3.5/site-packages/matplotlib/collections.py", line 713, in update_scalarmappable
self._facecolors = self.to_rgba(self._A, self._alpha)
File "/usr/local/lib/python3.5/site-packages/matplotlib/cm.py", line 262, in to_rgba
x = self.cmap(x, alpha=alpha, bytes=bytes)
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 550, in __call__
self._init()
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 845, in _init
rgba = colorConverter.to_rgba_array(self.colors)
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 422, in to_rgba_array
result[i] = self.to_rgba(cc, alpha)
File "/usr/local/lib/python3.5/site-packages/matplotlib/colors.py", line 376, in to_rgba
'to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgba: Invalid rgba arg "viridis"
to_rgb: Invalid rgb arg "viridis"
could not convert string to float: 'viridis'