'NoneType' object has no attribute 'endswith' when running tests in a chroot

Hello,
I've been trying to fix this problem for hours, and it's getting me
mad but to no conclusion, so I'm asking here.

In Debian we build our packges in a chroot, with all the minimum
dependecies needed to build the package (to guarantee reproducibility
and avoid weird effect of local installed packages), and so also the
unittests are runt here. While enabling the matplotlib unittest in
that chroot, I'm getting this error:

···

======================================================================
ERROR: matplotlib.tests.test_axes.test_arc_ellipse.test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/testing/decorators.py",
line 36, in failer
    result = f(*args, **kwargs)
  File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/testing/decorators.py",
line 128, in do_test
    figure.savefig(actual_fname)
  File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/figure.py",
line 1185, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/backend_bases.py",
line 2021, in print_figure
    **kwargs)
  File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/backend_bases.py",
line 1789, in print_pdf
    return pdf.print_pdf(*args, **kwargs)
  File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/backends/backend_pdf.py",
line 2180, in print_pdf
    file = PdfFile(filename)
  File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/backends/backend_pdf.py",
line 378, in __init__
    rcParams['datapath'], 'fonts', 'pdfcorefonts')
  File "/usr/lib/python2.6/posixpath.py", line 67, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

(repeated for several times, it seems like a patter, given the output
of the test execution is:

..K.............EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK..EK.EK.EK.EK.EK.EK.EKK...EK...EK.EK..EKEK..EK.EK.EK.EK.EK..EK.EK.EK[....]

and so on) so it seems the code can't find the datapath location. In
order to fix that, I'm calling the test suite like this:

PYTHONPATH=build/lib.linux-x86_64-2.6 \
        MATPLOTLIBDATA=/tmp/buildd/matplotlib-1.1.1~rc1/lib/matplotlib/mpl-data/
\
        MPLCONFIGDIR=. \
                python2.6 -c "import matplotlib as m ; m.test(verbosity=1)"

and in . there's a matplotlibrc file with simply:

  datapath : /tmp/buildd/matplotlib-1.1.1~rc1/lib/matplotlib/mpl-data/

in it; but still I got all of these failures. Anyone knows where I can
look to fix that?

Thanks in advance,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


Hello,
I've been trying to fix this problem for hours, and it's getting me
mad but to no conclusion, so I'm asking here.
In Debian we build our packges in a chroot, with all the minimum
dependecies needed to build the package (to guarantee reproducibility
and avoid weird effect of local installed packages), and so also the
unittests are runt here. While enabling the matplotlib unittest in
that chroot, I'm getting this error:
======================================================================
ERROR: matplotlib.tests.test_axes.test_arc_ellipse.test
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/testing/decorators.py",
line 36, in failer
result = f(*args, **kwargs)
File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/testing/decorators.py",
line 128, in do_test
figure.savefig(actual_fname)
File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/figure.py",
line 1185, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/backend_bases.py",
line 2021, in print_figure
**kwargs)
File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/backend_bases.py",
line 1789, in print_pdf
return pdf.print_pdf(*args, **kwargs)
File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/backends/backend_pdf.py",
line 2180, in print_pdf
file = PdfFile(filename)
File "/tmp/buildd/matplotlib-1.1.1~rc1/build/lib.linux-x86_64-2.6/matplotlib/backends/backend_pdf.py",
line 378, in __init__
rcParams['datapath'], 'fonts', 'pdfcorefonts')
File "/usr/lib/python2.6/posixpath.py", line 67, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
I'm not sure about this one.  Could it be due to not having a font

cache in ~/.matplotlib?


(repeated for several times, it seems like a patter, given the output
of the test execution is:
..K.............EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK.EK..EK.EK.EK.EK.EK.EK.EKK...EK...EK.EK..EKEK..EK.EK.EK.EK.EK..EK.EK.EK[....]
and so on) so it seems the code can't find the datapath location. In
order to fix that, I'm calling the test suite like this:
This is most likely due to some of the testing dependencies not

being present. matplotlib uses ghostscript for rendering PDF and
inkscape for rendering SVG (but only when testing). See this
documentation:

http://matplotlib.sourceforge.net/devel/coding_guide.html#testing

(Note the the PIL requirement goes away with matplotlib git master

– it’s only required for the 1.1.x series).

        PYTHONPATH=build/lib.linux-x86_64-2.6 \
MATPLOTLIBDATA=/tmp/buildd/matplotlib-1.1.1~rc1/lib/matplotlib/mpl-data/
\
MPLCONFIGDIR=. \
python2.6 -c "import matplotlib as m ; m.test(verbosity=1)"
and in . there's a matplotlibrc file with simply:
datapath : /tmp/buildd/matplotlib-1.1.1~rc1/lib/matplotlib/mpl-data/
in it; but still I got all of these failures. Anyone knows where I can
look to fix that?
Thanks in advance,

Cheers,

Mike
···

On 05/20/2012 12:51 PM, Sandro Tosi wrote:

(sigh - only now I find the time to work on it)

···

On Mon, May 21, 2012 at 1:34 PM, Michael Droettboom <mdroe@...31...> wrote:

This is most likely due to some of the testing dependencies not being
present. matplotlib uses ghostscript for rendering PDF and inkscape for
rendering SVG (but only when testing). See this documentation:

http://matplotlib.sourceforge.net/devel/coding_guide.html#testing

yep indeed - inkscape was missing, once installed almost all the tests
are passing, but I got some of them fail since the images doesn't
match: how can I report those problem? an issue on github attaching
the images pairs and the tests running output?

Cheers,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi