Skip to content

test_override_builtins failing on master #8732

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

Closed
dstansby opened this issue Jun 8, 2017 · 1 comment
Closed

test_override_builtins failing on master #8732

dstansby opened this issue Jun 8, 2017 · 1 comment
Milestone

Comments

@dstansby
Copy link
Member

dstansby commented Jun 8, 2017

The master travis python 3 builds are currently failing on test_override_builtins (https://travis-ci.org/matplotlib/matplotlib/jobs/240522447):

=================================== FAILURES ===================================

____________________________ test_override_builtins ____________________________

[gw0] linux -- Python 3.6.1 /home/travis/build/matplotlib/matplotlib/venv/bin/python

def test_override_builtins():

        import pylab

    

        ok_to_override = {

            '__name__',

            '__doc__',

            '__package__',

            '__loader__',

            '__spec__',

            'any',

            'all',

            'sum'

        }

    

        # We could use six.moves.builtins here, but that seems

        # to do a little more than just this.

        if six.PY3:

            builtins = sys.modules['builtins']

        else:

            builtins = sys.modules['__builtin__']

    

        overridden = False

        for key in dir(pylab):

            if key in dir(builtins):

                if (getattr(pylab, key) != getattr(builtins, key) and

                        key not in ok_to_override):

                    print("'%s' was overridden in globals()." % key)

                    overridden = True

    

>       assert not overridden

E       assert not True

lib/matplotlib/tests/test_basic.py:41: AssertionError

----------------------------- Captured stdout call -----------------------------

'divmod' was overridden in globals().
@jenshnielsen
Copy link
Member

jenshnielsen commented Jun 8, 2017

I think this is due to the release of numpy 1.13

Compare

In [1]: import numpy as np

In [2]: np.version.full_version
Out[2]: '1.13.0'

In [3]: np.divmod
Out[3]: <ufunc 'divmod'>

to

In [1]: import numpy as np

In [2]: np.version.full_version
Out[2]: '1.12.1'

In [3]: np.divmod
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-895646f35e69> in <module>()
----> 1 np.divmod

AttributeError: module 'numpy' has no attribute 'divmod'

So perhaps divmod should simply be added to ok_to_override?

Edit:

It's documented in the changelog too
https://github.com/numpy/numpy/releases/tag/v1.13.0

@QuLogic QuLogic added this to the 2.1 (next point release) milestone Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants