[Libreoffice-commits] core.git: sc/qa sw/qa

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sun Feb 14 15:46:50 UTC 2021


 sc/qa/uitest/conditional_format/tdf117899.py  |    6 ++++--
 sw/qa/python/text_portion_enumeration_test.py |    8 ++------
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 7ce4a3956a570841d5967ba1e555ded5613b6bc4
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Feb 14 17:50:20 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Feb 14 16:46:07 2021 +0100

    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 at collabora.com>

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


More information about the Libreoffice-commits mailing list