[Libreoffice-commits] core.git: pyuno/qa

Stephan Bergmann sbergman at redhat.com
Thu Apr 5 19:43:03 UTC 2018


 pyuno/qa/pytests/insertremovecells.py |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

New commits:
commit e21b2a61d64b697413c0fc9013746b9d358da4c6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 5 18:51:55 2018 +0200

    Fix Python file URL construction on Windows
    
    ...after d76281864b0e83812c0edf7490b1e8271e89fff5 "Create temp copies of test
    docs in Python/UITests"
    
    Change-Id: I0f331ca9567e9a54842cc35b35628046d29b176d
    Reviewed-on: https://gerrit.libreoffice.org/52470
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/pyuno/qa/pytests/insertremovecells.py b/pyuno/qa/pytests/insertremovecells.py
index e14717639d7e..f1c0fa176113 100644
--- a/pyuno/qa/pytests/insertremovecells.py
+++ b/pyuno/qa/pytests/insertremovecells.py
@@ -1,14 +1,9 @@
-import platform
+import pathlib
 import re
 import unittest
 
 from os import getenv, path
 
-try:
-    from urllib.request import pathname2url
-except ImportError:
-    from urllib import pathname2url
-
 from org.libreoffice.unotest import pyuno, mkPropertyValue, makeCopyFromTDOC
 
 
@@ -29,10 +24,8 @@ class InsertRemoveCells(unittest.TestCase):
           ('Hidden', True),
           ('ReadOnly', False)
         ))
-        tdoc_path = pathname2url(makeCopyFromTDOC('fdo74824.ods'))
-        if platform.system() == 'Windows':
-            tdoc_path = re.sub(r'^//(/[A-Za-z]:/)/', r'\1', tdoc_path)
-        url = 'file://' + tdoc_path
+        tdoc_path = makeCopyFromTDOC('fdo74824.ods')
+        url = pathlib.Path(tdoc_path).as_uri()
         doc = desktop.loadComponentFromURL(url, "_blank", 0, load_props)
 
         sheet = doc.Sheets.Sheet1


More information about the Libreoffice-commits mailing list