This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_minidom.py fails for Python-2.4.3 on SUSE 9.3
Type: behavior Stage: test needed
Components: XML Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: BreamoreBoy, akuchling, loewis, nnorwitz, rptownsend, tobixx
Priority: normal Keywords:

Created on 2006-04-02 14:03 by rptownsend, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
py_243.txt rptownsend, 2006-04-07 10:07
Messages (12)
msg28019 - (view) Author: Richard Townsend (rptownsend) Date: 2006-04-02 14:03
I built Python-2.4.3 from source on SUSE 9.3 and get
the following error for test_minidom.py

/usr/local/src/Python-2.4.3: ./python
Lib/test/test_minidom.py
Failed Test
Test Failed:  testAltNewline
Traceback (most recent call last):
  File "Lib/test/test_minidom.py", line 1384, in ?
    func()
  File "Lib/test/test_minidom.py", line 427, in
testAltNewline
    confirm(domstr == str.replace("\n", "\r\n"))
  File "Lib/test/test_minidom.py", line 28, in confirm
    raise Exception
Exception
<exceptions.Exception instance at 0x4036d6cc>
Failed testEncodings - encoding EURO SIGN
Test Failed:  testEncodings
Traceback (most recent call last):
  File "Lib/test/test_minidom.py", line 1384, in ?
    func()
  File "Lib/test/test_minidom.py", line 891, in
testEncodings
    "testEncodings - encoding EURO SIGN")
  File "Lib/test/test_minidom.py", line 28, in confirm
    raise Exception
Exception
<exceptions.Exception instance at 0x4037e46c>
Failed After replaceChild()
Test Failed:  testPatch1094164
Traceback (most recent call last):
  File "Lib/test/test_minidom.py", line 1384, in ?
    func()
  File "Lib/test/test_minidom.py", line 1137, in
testPatch1094164
    confirm(e.parentNode is elem, "After replaceChild()")
  File "Lib/test/test_minidom.py", line 28, in confirm
    raise Exception
Exception
<exceptions.Exception instance at 0x4037ec4c>
Failed Test
Test Failed:  testWriteXML
Traceback (most recent call last):
  File "Lib/test/test_minidom.py", line 1384, in ?
    func()
  File "Lib/test/test_minidom.py", line 420, in
testWriteXML
    confirm(str == domstr)
  File "Lib/test/test_minidom.py", line 28, in confirm
    raise Exception
Exception
<exceptions.Exception instance at 0x403b160c>



**** Check for failures in these tests:
  testAltNewline
  testEncodings
  testPatch1094164
  testWriteXML
msg28020 - (view) Author: Richard Townsend (rptownsend) Date: 2006-04-02 14:28
Logged In: YES 
user_id=200117

I've just retested with earlier versions.

No error with Python-2.4.1
Similar error with Python-2.4.2
msg28021 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-04-03 05:37
Logged In: YES 
user_id=33168

Thanks for letting us know about where the regression
occurred.  Can you do a little more debugging to try to find
the cause and some ideas about how to fix it?

I'm not sure that any developer runs on a system that
exhibits this error.  So it will probably be very difficult
for us to figure it out since we can't reproduce it.
msg28022 - (view) Author: Richard Townsend (rptownsend) Date: 2006-04-03 13:37
Logged In: YES 
user_id=200117

Hi Neal,

I've just built 2.4.3 on a Red Hat Enterpeise Edition WS 
V4.2 machine and this gives the same error.

I've had this vague feeling that I've seen something like 
this before, but couldn't find anything when I searched the 
tracker...

I've now realised that the error is due to a conflict with 
PyXML-0.8.4 which was already installed on both machines.

If I rename the ../site_packages/_xmlplus directory to a 
different name then the error goes away (on the Red Hat 
machine at least, the SUSE machine is at home).
msg28023 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-04-04 06:27
Logged In: YES 
user_id=33168

Martin maintains PyXML AFAIK.  Maybe he has some ideas.  I
suspect this might be even worse in 2.5. Element Tree was
added and there was a name change.  Some of those things
still need to be addressed.
msg28024 - (view) Author: Richard Townsend (rptownsend) Date: 2006-04-06 12:31
Logged In: YES 
user_id=200117

Interestingly, the error doesn't occur with Python-2.5a1
msg28025 - (view) Author: Richard Townsend (rptownsend) Date: 2006-04-07 10:07
Logged In: YES 
user_id=200117

I added a few print statements to the tests - see attached 
file py_243.txt for the results while running on Python-
2.4.3

msg28026 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-10 07:01
Logged In: YES 
user_id=21627

It's no surprise that the error didn't occur in 2.5a1: the
PyXML-0.8.4 installation on rptownsend's machine was for
2.4; the 2.5 sandbox won't see 2.4's xmlplus. Even if PyXML
was installed on 2.5, the test suite would still refer to
xmlcore, thus bypassing PyXML.
msg28027 - (view) Author: Steffen Tobias Oschatz (tobixx) Date: 2006-06-23 09:44
Logged In: YES 
user_id=694396

I can confirm this behavior for Red Hat Enterprise 3.
I installed Python 2.4.3 . The tests failed for pyexpat
(complaining that there is no expat.so) and minidom.
I installed PyXML-0.8.4 - that solves expat error, minidom
error was still there. Tests for PyXML all run fine.

I have looked into the test and find the following reason:

testAltNewline: 
---------------
str= '<?xml version="1.0" ?>\n<a b="c"/>\n'
dom.toprettyxml(newl="\r\n")
>>> u'<?xml version="1.0" ?>\n<a b="c"/>\r\n' 
str.replace("\n", "\r\n")
>>> '<?xml version="1.0" ?>\r\n<a b="c"/>\r\n' 
domstr == str.replace("\n", "\r\n")
>>> False

I assume the test should be: domstr == str.replace("\r\n"),
"\n") to pass it. But by the way: why is there an '\n' in
the pretty string? And i would suggest: unicode(str).

testWriteXML:
------------
str= '<?xml version="1.0" ?><a b="c"/>'
domstr=dom.toxml()
>>>  u'<?xml version="1.0" ?>\n<a b="c"/>'
str == domstr
>>> False

Whoops, where does the '\n' coming from ? :
toxml
  toprettyxml
    writexml:
    if encoding is None:
        writer.write('<?xml version="1.0" ?>\n')

I'm not a xml guy, but i ask myself: should such formating
really be in this place ?

testEncodings:
--------------
same as before

testPyth1094164:
----------------
I can confirm this behavior for Red Hat Enterprise 3.
I installed Python 2.4.3 . The tests failed for pyexpat
(complaining that there is no expat.so) and minidom.
I installed PyXML-0.8.4 - that solves expat error, minidom
error was still there. Tests for PyXML all run fine.

I have looked into the test and find the following reason:

testAltNewline: 
---------------
str= '<?xml version="1.0" ?>\n<a b="c"/>\n'
dom.toprettyxml(newl="\r\n")
>>> u'<?xml version="1.0" ?>\n<a b="c"/>\r\n' 
str.replace("\n", "\r\n")
>>> '<?xml version="1.0" ?>\r\n<a b="c"/>\r\n' 
domstr == str.replace("\n", "\r\n")
>>> False

I assume the test should be: domstr == str.replace("\r\n"),
"\n") to pass it. But by the way: why is there an '\n' in
the pretty string? And i would suggest: unicode(str).

testWriteXML:
------------
str= '<?xml version="1.0" ?><a b="c"/>'
domstr=dom.toxml()
>>>  u'<?xml version="1.0" ?>\n<a b="c"/>'
str == domstr
>>> False

Whoops, where does the '\n' coming from ? :
toxml
  toprettyxml
    writexml:
    if encoding is None:
        writer.write('<?xml version="1.0" ?>\n')

I'm not a xml guy, but i ask myself: should such formating
really be in this place ?

testEncodings:
--------------
same as before

testPyth1094164:
----------------
after elem.replaceChild(e, e) the dom is gone:

--------> type(elem.firstChild)
Out[129]: <type 'NoneType'>

--------> type(e.parentNode)
Out[130]: <type 'NoneType'>

And why ? 
replaceChild:

if newChild.parentNode is not None:
   newChild.parentNode.removeChild(newChild)
if newChild is oldChild:
   return

I assume the order of this if statement should be reversed.
msg59768 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-01-12 01:00
This seems to be an XML issue, not actually a build-related one.
msg111537 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-25 12:45
Can this be closed given that we're now at 2.7 and py3k and openSUSE is at 11.3?
msg111575 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2010-07-25 23:29
Closing.  The replaceChild() bug reported by tobixx was fixed by patch #1094164.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43147
2010-07-25 23:29:20akuchlingsetstatus: pending -> closed
resolution: fixed
messages: + msg111575
2010-07-25 12:45:41BreamoreBoysetstatus: open -> pending
nosy: + BreamoreBoy
messages: + msg111537

2009-03-30 06:32:50ajaksu2setstage: test needed
type: behavior
versions: + Python 2.6
2008-01-12 01:00:23akuchlingsetnosy: + akuchling
messages: + msg59768
components: + XML, - Build
2006-04-02 14:03:37rptownsendcreate