From e21b2a61d64b697413c0fc9013746b9d358da4c6 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 5 Apr 2018 18:51:55 +0200 Subject: 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 Reviewed-by: Stephan Bergmann --- pyuno/qa/pytests/insertremovecells.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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 -- cgit v1.2.3