summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-01 04:20:59 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-01 04:20:59 +0300
commitabcaf2f3338977659a3a6f489f2bbad0cf98ed23 (patch)
tree192284f8ef5def6213d4d396017bf79fa0873ea6
parent2625d2c77740cdd3535c9af91517533bdffa61ba (diff)
downloadtools-abcaf2f3338977659a3a6f489f2bbad0cf98ed23.tar.gz
tools-abcaf2f3338977659a3a6f489f2bbad0cf98ed23.tar.bz2
tools-abcaf2f3338977659a3a6f489f2bbad0cf98ed23.tar.xz
tools-abcaf2f3338977659a3a6f489f2bbad0cf98ed23.zip
testxml: Add different fixes after parsing tmw-br client data.
-rwxr-xr-xtestxml/testxml.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/testxml/testxml.py b/testxml/testxml.py
index b5c40a1..dc737b5 100755
--- a/testxml/testxml.py
+++ b/testxml/testxml.py
@@ -1413,13 +1413,18 @@ def testMap(mapName, file, path):
if source[-4:] == ".tsx":
relativePath = parentDir + "/" + mapsDir + source
- dom2 = minidom.parse(relativePath)
- tileset = dom2.documentElement
- idx = relativePath.rfind("/")
- relativePath = relativePath[:idx+1]
- relativePath2 = source
- idx = relativePath2.rfind("/")
- relativePath2 = relativePath2[:idx+1]
+ try:
+ dom2 = minidom.parse(relativePath)
+ tileset = dom2.documentElement
+ idx = relativePath.rfind("/")
+ relativePath = relativePath[:idx+1]
+ relativePath2 = source
+ idx = relativePath2.rfind("/")
+ relativePath2 = relativePath2[:idx+1]
+ showMsgFile(file, "tsx not found: " + source, True)
+ except:
+ relativePath = ""
+ relativePath2 = ""
else:
relativePath = ""
relativePath2 = ""
@@ -2212,9 +2217,14 @@ def testItemColors(fileName):
testDyeColors(id, colorDye, colorDye, name, True)
def loadMapAtlases(fileName):
- root = ElementTree.parse(parentDir + "/" + fileName).getroot()
mapToAtlas = dict()
atlasToFiles = dict()
+ try:
+ root = ElementTree.parse(parentDir + "/" + fileName).getroot()
+ except:
+ showMsgFile(fileName, "load xml error. Probably file missing", True)
+ return (mapToAtlas, atlasToFiles)
+
for node in root.findall("map"):
mapName = node.attrib["name"]
atlasNode = node.find("atlas")
@@ -2232,7 +2242,7 @@ def loadMapAtlases(fileName):
for mapName in mapToAtlas:
atlasName = mapToAtlas[mapName]
if atlasName not in atlasToFiles:
- showMsg(fileName, "atlas '{0}' assigned to map not present in maps.xml".format(atlasName), True)
+ showMsgFile(fileName, "atlas '{0}' assigned to map not present in maps.xml".format(atlasName), True)
return (mapToAtlas, atlasToFiles)