Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix for broken maplotlib.test function #5537

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2015

Conversation

phobson
Copy link
Member

@phobson phobson commented Nov 20, 2015

So if I try to run import matplotlib; matplotlib.test(), I get this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-dc738b53f7b4> in <module>()
----> 1 mpl.test()

/home/paul/miniconda3/envs/mpldev/lib/python3.4/site-packages/matplotlib/__init__.py in test(verbosity, coverage)
   1553         plugins.extend([plugin() for plugin in nose.plugins.builtin.plugins])
   1554 
-> 1555         manager = PluginManager(plugins=[x() for x in plugins])
   1556         config = nose.config.Config(verbosity=verbosity, plugins=manager)
   1557 

/home/paul/miniconda3/envs/mpldev/lib/python3.4/site-packages/matplotlib/__init__.py in <listcomp>(.0)
   1553         plugins.extend([plugin() for plugin in nose.plugins.builtin.plugins])
   1554 
-> 1555         manager = PluginManager(plugins=[x() for x in plugins])
   1556         config = nose.config.Config(verbosity=verbosity, plugins=manager)
   1557 

TypeError: 'AttributeSelector' object is not callable

This was b/c we call some plugins in a list comprehension twice (https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/__init__.py#L1551)

When we gather the plugins, we go through two list comprehensions,
but call them each time. So on the second pass, the plugins that
were called the first time can't be called again. This change
makes it so that all fo the plugins are called together in the
second list comprehension.
@@ -1550,7 +1550,7 @@ def test(verbosity=1, coverage=False):

# store the old values before overriding
plugins = _get_extra_test_plugins()
plugins.extend([plugin() for plugin in nose.plugins.builtin.plugins])
plugins.extend([plugin for plugin in nose.plugins.builtin.plugins])

manager = PluginManager(plugins=[x() for x in plugins])
Copy link
Member Author

Choose a reason for hiding this comment

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

we only need to call the plugins here.

tacaswell added a commit that referenced this pull request Nov 21, 2015
FIX: for broken maplotlib.test function
@tacaswell tacaswell merged commit 05cf385 into matplotlib:master Nov 21, 2015
@QuLogic
Copy link
Member

QuLogic commented Nov 21, 2015

Should be in 1.5.x as well?

@tacaswell
Copy link
Member

It does not back port cleanly. I have not checked, but i think this is
broken only on master after the test code path unification

On Sat, Nov 21, 2015, 18:38 Elliott Sales de Andrade <
[email protected]> wrote:

Should be in 1.5.x as well?


Reply to this email directly or view it on GitHub
#5537 (comment)
.

@phobson phobson deleted the fix-test-function branch November 22, 2015 01:18
@QuLogic
Copy link
Member

QuLogic commented Nov 22, 2015

Oh right, I may have confused this one with #5487.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants