summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-04-05 18:51:55 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-04-05 21:42:42 +0200
commite21b2a61d64b697413c0fc9013746b9d358da4c6 (patch)
tree732ee8f509663a805e405c3f7d31c96c3f19a26e
parenta174caa53b4bee9627cd7403ef03c474b758c602 (diff)
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@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--pyuno/qa/pytests/insertremovecells.py13
1 files 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