summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-02-14 17:50:20 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-02-14 16:46:07 +0100
commit7ce4a3956a570841d5967ba1e555ded5613b6bc4 (patch)
tree5a57ad0b11b229087310a6fcd4d9575e2ab02993
parent984a1827508e7298611476cf747c4acc96dec58a (diff)
Handle system paths and URLs properly
Avoids errors like this: make UITest_conditional_format ... Execution time for tdf117899.Tdf117899.test_tdf117899: 9.992 tearDown: calling terminate()... ...done ERROR ====================================================================== ERROR: test_tdf117899 (tdf117899.Tdf117899) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:/lo/src/core/sc/qa/uitest/conditional_format/tdf117899.py", line 64, in test_tdf117899 self.ui_test.load_file('file://' + xFilePath) File "C:\lo\src\core\uitest\uitest\test.py", line 76, in load_file component = desktop.loadComponentFromURL(url, target, 0, tuple()) uitest.test.com.sun.star.lang.IllegalArgumentException: Unsupported URL <file://C:\cygwin64\tmp\tmpfs3x8j2r/tdf117899-temp.ods>: "type detection failed" ---------------------------------------------------------------------- Change-Id: Ifbf62c0aaa72412dc0efca921f59441d09c54d90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110882 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sc/qa/uitest/conditional_format/tdf117899.py6
-rw-r--r--sw/qa/python/text_portion_enumeration_test.py8
2 files changed, 6 insertions, 8 deletions
diff --git a/sc/qa/uitest/conditional_format/tdf117899.py b/sc/qa/uitest/conditional_format/tdf117899.py
index ac3dead06b46..6b9b9abbd4e7 100644
--- a/sc/qa/uitest/conditional_format/tdf117899.py
+++ b/sc/qa/uitest/conditional_format/tdf117899.py
@@ -8,7 +8,9 @@ from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
from libreoffice.calc.document import get_cell_by_position
+from org.libreoffice.unotest import systemPathToFileUrl
from tempfile import TemporaryDirectory
+import os.path
class Tdf117899(UITestCase):
@@ -38,7 +40,7 @@ class Tdf117899(UITestCase):
self.ui_test.close_doc()
with TemporaryDirectory() as tempdir:
- xFilePath = tempdir + "/tdf117899-temp.ods"
+ xFilePath = os.path.join(tempdir, "tdf117899-temp.ods")
self.ui_test.load_empty_file("writer")
@@ -61,7 +63,7 @@ class Tdf117899(UITestCase):
# Close the Writer document
self.ui_test.close_doc()
- self.ui_test.load_file('file://' + xFilePath)
+ self.ui_test.load_file(systemPathToFileUrl(xFilePath))
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
diff --git a/sw/qa/python/text_portion_enumeration_test.py b/sw/qa/python/text_portion_enumeration_test.py
index c379138db303..52b1c2c8b702 100644
--- a/sw/qa/python/text_portion_enumeration_test.py
+++ b/sw/qa/python/text_portion_enumeration_test.py
@@ -3282,9 +3282,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
if xComp:
self.checkloadmeta(xComp)
with TemporaryDirectory() as tempdir:
- if os.altsep: # we need URL so replace "\" with "/"
- tempdir = tempdir.replace(os.sep, os.altsep)
- file = tempdir + "/" + filename
+ file = os.path.join(tempdir, filename)
self.dostore(xComp, file)
self.close(xComp)
xComp2 = None
@@ -3354,9 +3352,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
if xComp:
self.checkloadxmlid(xComp)
with TemporaryDirectory() as tempdir:
- if os.altsep: # we need URL so replace "\" with "/"
- tempdir = tempdir.replace(os.sep, os.altsep)
- file = tempdir + "/" + filename
+ file = os.path.join(tempdir, filename)
self.dostore(xComp, file)
self.close(xComp)
xComp2 = None