summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-09-07 17:42:19 +0200
committerMichael Stahl <mstahl@redhat.com>2017-09-07 18:05:31 +0200
commite137b0ee2ac2c7dcd209f44768433b709c432918 (patch)
tree7ee9bab0b2f5ede5b6aef0fd1f274fd0fac54692
parentd74424a09ee7207138ad9da0869b194d3d5c476c (diff)
sw: fix text_portion_enumeration_test.py on WNT
This fails, mostly because of confusing native paths and URLs, and because of deleting the temp. directory before closing the file that the test wrote into it. Also, why open the document as a template. Change-Id: I6da2f3f2c47308c4956444869b5b100a124b8db0
-rw-r--r--sw/qa/python/text_portion_enumeration_test.py32
1 files changed, 22 insertions, 10 deletions
diff --git a/sw/qa/python/text_portion_enumeration_test.py b/sw/qa/python/text_portion_enumeration_test.py
index cc7a28e785ea..343a7da39196 100644
--- a/sw/qa/python/text_portion_enumeration_test.py
+++ b/sw/qa/python/text_portion_enumeration_test.py
@@ -770,8 +770,8 @@ class EnumConverter():
continue
else:
node = self._stack.pop()
- assert (isinstance(node, RubyNode),
- "stack error: Ruby expected; is: {}".format(str(node)))
+ assert (isinstance(node, RubyNode)),
+ "stack error: Ruby expected; is: {}".format(str(node))
elif type_ == "InContentMetadata":
xMeta = xPortion.InContentMetadata
xmlid = xMeta.MetadataReference
@@ -3267,15 +3267,21 @@ class TextPortionEnumerationTest(unittest.TestCase):
xComp = None
filename = "TESTMETA.odt"
try:
- xComp = self.__class__._uno.openWriterTemplateDoc(filename)
+ xComp = self.__class__._uno.openBaseDoc(filename)
if xComp:
self.checkloadmeta(xComp)
with TemporaryDirectory() as tempdir:
- file = os.path.join(tempdir, filename)
+ if os.altsep: # we need URL so replace "\" with "/"
+ tempdir = tempdir.replace(os.sep, os.altsep)
+ file = tempdir + "/" + filename
self.dostore(xComp, file)
self.close(xComp)
- xComp = self.doload(file)
- self.checkloadmeta(xComp)
+ xComp2 = None
+ try:
+ xComp2 = self.doload(file)
+ self.checkloadmeta(xComp2)
+ finally:
+ self.close(xComp2)
finally:
self.close(xComp)
@@ -3333,15 +3339,21 @@ class TextPortionEnumerationTest(unittest.TestCase):
xComp = None
filename = "TESTXMLID.odt"
try:
- xComp = self.__class__._uno.openWriterTemplateDoc(filename)
+ xComp = self.__class__._uno.openBaseDoc(filename)
if xComp:
self.checkloadxmlid(xComp)
with TemporaryDirectory() as tempdir:
- file = os.path.join(tempdir, filename)
+ if os.altsep: # we need URL so replace "\" with "/"
+ tempdir = tempdir.replace(os.sep, os.altsep)
+ file = tempdir + "/" + filename
self.dostore(xComp, file)
self.close(xComp)
- xComp = self.doload(file)
- self.checkloadxmlid(xComp)
+ xComp2 = None
+ try:
+ xComp2 = self.doload(file)
+ self.checkloadxmlid(xComp2)
+ finally:
+ self.close(xComp2)
finally:
self.close(xComp)