summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-09-12 17:03:02 (GMT)
committerFred Drake <fdrake@acm.org>2002-09-12 17:03:02 (GMT)
commit6dd7d07aa65f66fe9d99caf905b897af2277af30 (patch)
tree65680874e5af29ded9e4f7e39a665712b6eb6da0
parentd2909c901e194bd504f65e18b37cafcec43bfcd9 (diff)
downloadcpython-6dd7d07aa65f66fe9d99caf905b897af2277af30.zip
cpython-6dd7d07aa65f66fe9d99caf905b897af2277af30.tar.gz
cpython-6dd7d07aa65f66fe9d99caf905b897af2277af30.tar.bz2
If PyXML is installed, there is no Node.allnodes, so that portion of
the test should be skipped if that's the case.
-rw-r--r--Lib/test/test_minidom.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index 9e00b4f..0791bbf 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -618,22 +618,33 @@ names.sort()
failed = []
+try:
+ Node.allnodes
+except AttributeError:
+ # We don't actually have the minidom from teh standard library,
+ # but are picking up the PyXML version from site-packages.
+ def check_allnodes():
+ pass
+else:
+ def check_allnodes():
+ confirm(len(Node.allnodes) == 0,
+ "assertion: len(Node.allnodes) == 0")
+ if len(Node.allnodes):
+ print "Garbage left over:"
+ if verbose:
+ print Node.allnodes.items()[0:10]
+ else:
+ # Don't print specific nodes if repeatable results
+ # are needed
+ print len(Node.allnodes)
+ Node.allnodes = {}
+
for name in names:
if name.startswith("test"):
func = globals()[name]
try:
func()
- confirm(len(Node.allnodes) == 0,
- "assertion: len(Node.allnodes) == 0")
- if len(Node.allnodes):
- print "Garbage left over:"
- if verbose:
- print Node.allnodes.items()[0:10]
- else:
- # Don't print specific nodes if repeatable results
- # are needed
- print len(Node.allnodes)
- Node.allnodes = {}
+ check_allnodes()
except:
failed.append(name)
print "Test Failed: ", name