On Mon, Mar 17, at 08:20 Randy McMurchy wrote:
> Hi all,
>
> Quick question about a little hiccup in a Python installation:
>
> If you use some sort of package manager and remove an existing Python
> installation (but preserved all the add-on modules you've installed
> since the initial Python installation), you'll have an existing
> /usr/lib/python2.5 directory.
>
> Now, if one of the add-on modules you've installed happens to be the
> PyXML module, then the test suite for Python will fail with a segfault
> while testing the test_pyexpat.py test.
>
> Even though /usr/lib/python2.5 is not in the PYTHONPATH (in fact
> that envar was unset before I started the Python installation), you'll
> see this failure.
>
> The only way I was able to fix it is to rename the /usr/lib/python2.5
> directory before building the package and running 'make test', then
> renaming it back to /usr/lib/python2.5 before 'make install'.
>
> Does anyone know a cleaner way to make Python build/run tests without
> having to rename the /usr/lib/python2.5 directory?
>
> TIA for any information you may have.
>
I had a quick look on this, I didn't found yet the reason, but here my
observations so far.
First:
The actual command which run the tests is:
LD_LIBRARY_PATH=/tmp/Python-2.5.2: ./python -E -tt ./Lib/test/regrtest.py -l
The "-E" switch unset the PYTHONPATH environment variable, so it's not
the blame.
The regrtest.py runs a series of test in all the test_* files will find
in the testdir variable.
This variable is getting its value using the findtestdir() function:
testdir = os.path.dirname(file) or os.curdir
which returns Lib/test, since "file" is:
file = sys.argv[0]
>>> import os
>>> os.path.dirname('Lib/test/regrtest.py')
'Lib/test'
>>>
So I don't think is running any tests in the "/usr/lib/python2.5/test"
directory.
What I think it happens, is that there is (probably) a reference from one
of the tests to one of the installed files from the PyXMl module.
I installed that same module and indeed I get a segmentation fault at the
same point.
Looking further I see this output in "Lib/test/output/test_pyexpat":
========================================================================
Testing constructor for proper handling of namespace_separator values:
Legal values tested o.k.
Caught expected TypeError:
ParserCreate() argument 2 must be string or None, not int
Caught expected ValueError:
namespace_separator must be at most one character, omitted, or None
========================================================================
Which is expected.
You can look at the code and you can verify it, in:
vim -c "normal 179ggV13j" Lib/test/test_pyexpat.py
or in
vim -c "normal 179ggV13j" /usr/lib/python2.5/test/test_pyexpat.py
At this point I stopped as I don't have the skills to do more debugging.
Another opinion from a python guru is welcomed.
By the way. The PyXML module is unmaintained and maybe the code wan not
meant to be run under 2.5*.
--
http://wiki.linuxfromscratch.org/blfs/wiki/Hacking
--
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page