Skip to content

doctests fail with numpy 1.14

======================================================================
FAIL: saveDataTxt (yade.plot)
Doctest: yade.plot.saveDataTxt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for yade.plot.saveDataTxt
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 614, in saveDataTxt

----------------------------------------------------------------------
File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 626, in yade.plot.saveDataTxt
Failed example:
    d=numpy.genfromtxt('/tmp/dataFile.txt.bz2',dtype=None,names=True)
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest yade.plot.saveDataTxt[8]>", line 1, in <module>
        d=numpy.genfromtxt('/tmp/dataFile.txt.bz2',dtype=None,names=True)
      File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 1689, in genfromtxt
        fhd = iter(np.lib._datasource.open(fname, 'rt', encoding=encoding))
      File "/usr/lib/python2.7/dist-packages/numpy/lib/_datasource.py", line 260, in open
        return ds.open(path, mode, encoding=encoding, newline=newline)
      File "/usr/lib/python2.7/dist-packages/numpy/lib/_datasource.py", line 614, in open
        encoding=encoding, newline=newline)
      File "/usr/lib/python2.7/dist-packages/numpy/lib/_datasource.py", line 88, in _python2_bz2open
        raise ValueError("bz2 text files not supported in python2")
    ValueError: bz2 text files not supported in python2
----------------------------------------------------------------------
File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 627, in yade.plot.saveDataTxt
Failed example:
    d['a']
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest yade.plot.saveDataTxt[9]>", line 1, in <module>
        d['a']
    NameError: name 'd' is not defined
----------------------------------------------------------------------
File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 629, in yade.plot.saveDataTxt
Failed example:
    d['b']
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest yade.plot.saveDataTxt[10]>", line 1, in <module>
        d['b']
    NameError: name 'd' is not defined

----------------------------------------------------------------------
Ran 58 tests in 1.063s

Original bug report by Dan Watkins : https://bugs.launchpad.net/yade/+bug/1774065

Edited by Janek Kozicki