summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2023-04-28 17:29:34 +0200
committerRobert Löhning <robert.loehning@qt.io>2023-05-02 09:14:12 +0000
commitd86b09129732e8f2f4c4b8970e65fb60e7d6fcde (patch)
treef5794176d44beece0ff7229e90ea4fdceda02a13
parentfac2e3c548c711a523187be3ae90c922a22b2863 (diff)
downloadqt-creator-d86b09129732e8f2f4c4b8970e65fb60e7d6fcde.tar.gz
SquishTests: Further Python3 adaption
Fixing tests in suite_editors Change-Id: I4e5e1adc2c4e6606232d76a794aff7a7144d5c9e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--tests/system/shared/project.py1
-rw-r--r--tests/system/shared/utils.py9
-rw-r--r--tests/system/suite_editors/tst_clean_whitespaces/test.py2
-rw-r--r--tests/system/suite_editors/tst_select_all/test.py2
4 files changed, 10 insertions, 4 deletions
diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py
index 06c7e115e3..babbf0eb6e 100644
--- a/tests/system/shared/project.py
+++ b/tests/system/shared/project.py
@@ -544,6 +544,7 @@ def checkAndCopyFiles(dataSet, fieldName, templateDir):
files = map(lambda record:
os.path.normpath(os.path.join(srcPath, testData.field(record, fieldName))),
dataSet)
+ files = list(files) # copy data from map object to list to make it reusable
for currentFile in files:
if not neededFilePresent(currentFile):
return []
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index 7397fad5ed..96e63f29f0 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -513,8 +513,13 @@ def progressBarWait(timeout=60000, warn=True):
checkIfObjectExists(":Qt Creator_Core::Internal::ProgressBar", False, timeout)
def readFile(filename):
- with open(filename, "r") as f:
- return f.read()
+ try:
+ with open(filename, "r") as f:
+ return f.read()
+ except:
+ # Read file as binary
+ with open(filename, "rb") as f:
+ return f.read()
def simpleFileName(navigatorFileName):
# try to find the last part of the given name, assume it's inside a (folder) structure
diff --git a/tests/system/suite_editors/tst_clean_whitespaces/test.py b/tests/system/suite_editors/tst_clean_whitespaces/test.py
index cdf2add27c..6dab4720f9 100644
--- a/tests/system/suite_editors/tst_clean_whitespaces/test.py
+++ b/tests/system/suite_editors/tst_clean_whitespaces/test.py
@@ -12,7 +12,7 @@ TripleTab = '\t\t\t'
def main():
files = map(lambda record: os.path.join(srcPath, testData.field(record, "filename")),
testData.dataset("files.tsv"))
- files = filter(lambda x: not x.endswith(".bin"), files)
+ files = list(filter(lambda x: not x.endswith(".bin"), files))
for currentFile in files:
if not neededFilePresent(currentFile):
return
diff --git a/tests/system/suite_editors/tst_select_all/test.py b/tests/system/suite_editors/tst_select_all/test.py
index be96e8f482..bf95250cf7 100644
--- a/tests/system/suite_editors/tst_select_all/test.py
+++ b/tests/system/suite_editors/tst_select_all/test.py
@@ -8,7 +8,7 @@ source("../../shared/qtcreator.py")
def main():
files = map(lambda record: os.path.join(srcPath, testData.field(record, "filename")),
testData.dataset("files.tsv"))
- files = filter(lambda x: not x.endswith(".bin"), files)
+ files = list(filter(lambda x: not x.endswith(".bin"), files))
for currentFile in files:
if not neededFilePresent(currentFile):
return