branliu0 / heroku-buildpack-scipy

Custom Heroku buildpack for Python with NumPy and SciPy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numpy 1.9.2 test failures

branliu0 opened this issue · comments

Here were my test results on numpy 1.9.2: one test failure; not really sure what to do about it.

Running unit tests for numpy
NumPy version 1.9.2
NumPy is installed in /app/.heroku/python/lib/python2.7/site-packages/numpy
Python version 2.7.8 (default, Jul  9 2014, 20:47:08) [GCC 4.4.3]
nose version 1.3.3
............................S.........S..............................................................................................................................................................................................................................................................................................................................................SS...........................................................................................S....................................................................................................................S................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................K............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................K.........................................................................SSSSS.........................................K......................K.............................................................................................................ESS....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................K...........................................................
======================================================================
ERROR: Failure: ValueError (Empty module name)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python2.7/site-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/app/.heroku/python/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/app/.heroku/python/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/app/.heroku/python/lib/python2.7/site-packages/numpy/doc/__init__.py", line 11, in <module>
    __import__(__name__ + '.' + f)
ValueError: Empty module name

----------------------------------------------------------------------
Ran 5236 tests in 45.756s

I'm also getting some intermittent failures:

One time, I got:

======================================================================
FAIL: test_default (test_numeric.TestSeterr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python2.7/site-packages/numpy/core/tests/test_numeric.py", line 407, in test_default
    under='ignore',
AssertionError: {'divide': 'warn', 'under': 'ignore', 'invalid': 'warn', 'over': 'raise'} != {'under': 'ignore', 'invalid': 'warn', 'divide': 'warn', 'over': 'warn'}
- {'divide': 'warn', 'invalid': 'warn', 'over': 'raise', 'under': 'ignore'}
?                                                 ^^^^

+ {'divide': 'warn', 'invalid': 'warn', 'over': 'warn', 'under': 'ignore'}
?                                                ++ ^


----------------------------------------------------------------------

And one other time, I got:

======================================================================
FAIL: test_allnans (test_nanfunctions.TestNanFunctions_Median)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python2.7/site-packages/numpy/lib/tests/test_nanfunctions.py", line 613, in test_allnans
    assert_(len(w) == 3)
  File "/app/.heroku/python/lib/python2.7/site-packages/numpy/testing/utils.py", line 53, in assert_
    raise AssertionError(smsg)
AssertionError

----------------------------------------------------------------------

I recompiled numpy 1.9.2 -- I'm not picking up any intermittent failures.

I don't think that ValueError thing is a big issue, although I could be wrong. If it becomes an issue in the future, here is the patch I added for future reference:

Replace numpy/doc/__init__.py with:

from __future__ import division, absolute_import, print_function

import os

ref_dir = os.path.join(os.path.dirname(__file__))

__all__ = sorted(f[:-3] for f in os.listdir(ref_dir) if f.endswith('.py') and
           not f.startswith('__'))

for f in __all__:
    try:
        __import__(__name__ + '.' + f)
    except ValueError:
        pass  # print(f)

del f, ref_dir

__doc__ = """\
Topical documentation
=====================

The following topics are available:
%s

You can view them by

>>> help(np.doc.TOPIC)                                      #doctest: +SKIP

""" % '\n- '.join([''] + __all__)

__all__.extend(['__doc__'])

Basically, I wrapped the __import__ statement with a try/except.