aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2023-03-21 10:10:03 +0100
committerChristian Stenger <christian.stenger@qt.io>2023-03-27 04:36:30 +0000
commitac4aaf5e231a5e266fb6f7416d965c4cb5bb0283 (patch)
treed6962abebff0f0f14dcf32e1a09f0a16c1102afa /tests
parentf7639f458a4b87263e96de70f26554a660148bc3 (diff)
SquishTests: Some Python3 adaption
Makes some tests succeed and lets a couple of tests get further on macOS. Change-Id: I9a3f124c094e67f51748ddae47d00897fe5259d5 Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/system/shared/debugger.py4
-rw-r--r--tests/system/shared/editor_utils.py4
-rw-r--r--tests/system/shared/utils.py2
-rw-r--r--tests/system/suite_debugger/tst_qml_locals/Tree.py2
-rw-r--r--tests/system/suite_debugger/tst_qml_locals/test.py2
-rw-r--r--tests/system/suite_editors/tst_rename_macros/test.py2
-rw-r--r--tests/system/suite_editors/tst_revert_changes/test.py4
-rw-r--r--tests/system/suite_general/tst_default_settings/test.py8
-rw-r--r--tests/system/suite_qtquick/tst_qml_outline/test.py2
-rw-r--r--tests/system/suite_tools/tst_git_local/test.py2
10 files changed, 16 insertions, 16 deletions
diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py
index d337ac497fd..4dbc13fcaaf 100644
--- a/tests/system/shared/debugger.py
+++ b/tests/system/shared/debugger.py
@@ -57,7 +57,7 @@ def setBreakpointsForCurrentProject(filesAndLines):
"window=':Qt Creator_Core::Internal::MainWindow'}")
breakPointList = []
for current in filesAndLines:
- for curFile,curLine in current.iteritems():
+ for curFile,curLine in current.items():
if not openDocument(curFile):
return None
editor = getEditorForFileSuffix(curFile, True)
@@ -239,7 +239,7 @@ def __logDebugResult__():
def verifyBreakPoint(bpToVerify):
if isinstance(bpToVerify, dict):
- fileName = bpToVerify.keys()[0]
+ fileName = list(bpToVerify.keys())[0]
editor = getEditorForFileSuffix(fileName)
if editor:
test.compare(waitForObject(":DebugModeWidget_QComboBox").toolTip, fileName,
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py
index 0933253c2a8..642cdb41ba0 100644
--- a/tests/system/shared/editor_utils.py
+++ b/tests/system/shared/editor_utils.py
@@ -168,7 +168,7 @@ def __handleTextTips__(textTip, expectedVals, alternativeVals):
if not expFail:
test.passes("TextTip verified")
else:
- for key,val in eResult.iteritems():
+ for key,val in eResult.items():
if val == False:
if aResult and aResult.get(key):
test.passes("Property '%s' does not match expected, but alternative value" % key)
@@ -240,7 +240,7 @@ def verifyProperties(properties, expectedProps):
test.warning("Wrong usage - both parameter must be of type dict")
return {}
result = {}
- for key,val in expectedProps.iteritems():
+ for key,val in expectedProps.items():
foundVal = properties.get(key, None)
if foundVal != None:
result[key] = val == foundVal
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index ced96b5bb2c..7397fad5ed6 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -342,7 +342,7 @@ def getConfiguredKits():
# update collected Qt versions with their configured device and version
iterateKits(False, True, __setQtVersionForKit__, kitsWithQtVersionName)
# merge defined target names with their configured Qt versions and devices
- for kit, qtVersion in kitsWithQtVersionName.iteritems():
+ for kit, qtVersion in kitsWithQtVersionName.items():
if qtVersion in qtVersionNames:
result.append(kit)
else:
diff --git a/tests/system/suite_debugger/tst_qml_locals/Tree.py b/tests/system/suite_debugger/tst_qml_locals/Tree.py
index 2290081c6aa..2499f28f34e 100644
--- a/tests/system/suite_debugger/tst_qml_locals/Tree.py
+++ b/tests/system/suite_debugger/tst_qml_locals/Tree.py
@@ -51,7 +51,7 @@ class Tree:
def countChildOccurrences(self, name):
if not self.__children__:
return 0
- return map(lambda x: x.getName(), self.__children__).count(name)
+ return list(map(lambda x: x.getName(), self.__children__)).count(name)
# internal functions
def __repr__(self):
diff --git a/tests/system/suite_debugger/tst_qml_locals/test.py b/tests/system/suite_debugger/tst_qml_locals/test.py
index 57ba361784b..70256ee2d44 100644
--- a/tests/system/suite_debugger/tst_qml_locals/test.py
+++ b/tests/system/suite_debugger/tst_qml_locals/test.py
@@ -136,7 +136,7 @@ def checkForExpectedValues(items, expectedChildren, expectedProperties):
properties = items.getChild("Properties")
if properties:
children = properties.getChildren()
- for property,value in expectedProperties.iteritems():
+ for property,value in expectedProperties.items():
foundProperty = getProperty(property, children)
if foundProperty:
test.compare(foundProperty.getValue(), value, "Verifying value for %s" % property)
diff --git a/tests/system/suite_editors/tst_rename_macros/test.py b/tests/system/suite_editors/tst_rename_macros/test.py
index e0a26fdd114..0ad013cc9a2 100644
--- a/tests/system/suite_editors/tst_rename_macros/test.py
+++ b/tests/system/suite_editors/tst_rename_macros/test.py
@@ -113,7 +113,7 @@ def performMacroRenaming(newMacroName):
def verifyChangedContent(origTexts, replacedSymbol, replacement):
global cppEditorStr
successfullyCompared = []
- for fileName,text in origTexts.iteritems():
+ for fileName,text in origTexts.items():
if openDocument(fileName):
successfullyCompared.append(test.compare(waitForObject(cppEditorStr).plainText,
text.replace(replacedSymbol, replacement),
diff --git a/tests/system/suite_editors/tst_revert_changes/test.py b/tests/system/suite_editors/tst_revert_changes/test.py
index bc666dd8c0b..6ad06b11243 100644
--- a/tests/system/suite_editors/tst_revert_changes/test.py
+++ b/tests/system/suite_editors/tst_revert_changes/test.py
@@ -29,7 +29,7 @@ def main():
"testfiles.Headers.testfile\\.h":__modifyHeader__,
"testfiles.Sources.testfile\\.cpp":__modifySource__,
"testfiles.Sources.main\\.cpp":None}
- for fileName, modification in fileModifications.iteritems():
+ for fileName, modification in fileModifications.items():
__modifyFile__(fileName, modification)
test.log("Reverting all files...")
fileModifications = dict(zip(fileModifications.keys(),
@@ -84,7 +84,7 @@ def __modifySource__():
type(cppEditorStr, "<Delete>")
def revertChanges(files):
- for f,canRevert in files.iteritems():
+ for f,canRevert in files.items():
simpleName = simpleFileName(f)
test.log("Trying to revert changes for '%s'" % simpleName)
if openDocument(f):
diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py
index 83c7171388d..5eacc517f9b 100644
--- a/tests/system/suite_general/tst_default_settings/test.py
+++ b/tests/system/suite_general/tst_default_settings/test.py
@@ -260,10 +260,10 @@ def __compareCompilers__(foundCompilers, expectedCompilers):
for currentExp in expectedCompilers:
if isString(currentExp):
continue
- key = currentExp.keys()[0]
+ key = list(currentExp.keys())[0]
# the regex .*? is used for the different possible version strings of the WinSDK
# if it's present a regex will be validated otherwise simple string comparison
- if (((".*?" in key and re.match(key, currentFound.keys()[0], flags))
+ if (((".*?" in key and re.match(key, list(currentFound.keys())[0], flags))
or currentFound.keys() == currentExp.keys())):
if ((isWin and os.path.abspath(currentFound.values()[0].lower())
== os.path.abspath(currentExp.values()[0].lower()))
@@ -322,8 +322,8 @@ def __checkCreatedSettings__(settingsFolder):
test.verify(os.path.isdir(f),
"Verifying whether folder '%s' has been created." % os.path.basename(f))
for f in files:
- fName = f.keys()[0]
- fMinSize = f.values()[0]
+ fName = list(f.keys())[0]
+ fMinSize = list(f.values())[0]
text = "created non-empty"
if fMinSize > 0:
text = "modified"
diff --git a/tests/system/suite_qtquick/tst_qml_outline/test.py b/tests/system/suite_qtquick/tst_qml_outline/test.py
index 1508dc9aaa8..fb3662b8057 100644
--- a/tests/system/suite_qtquick/tst_qml_outline/test.py
+++ b/tests/system/suite_qtquick/tst_qml_outline/test.py
@@ -109,7 +109,7 @@ def retrieveData(record):
def verifyOutline(outlinePseudoTree, datasetFileName):
fileName = datasetFileName[:datasetFileName.index("_")]
- expected = map(retrieveData, testData.dataset(datasetFileName))
+ expected = list(map(retrieveData, testData.dataset(datasetFileName)))
if len(expected) != len(outlinePseudoTree):
test.fail("Mismatch in length of expected and found elements of outline. Skipping "
"verification of nodes.",
diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py
index 7b83947e88a..07208367fdb 100644
--- a/tests/system/suite_tools/tst_git_local/test.py
+++ b/tests/system/suite_tools/tst_git_local/test.py
@@ -89,7 +89,7 @@ def __clickCommit__(count):
{"Author: %s, %s" % (id, time): True},
{"Committer: %s, %s" % (id, time): True}]
for line, exp in zip(show.splitlines(), expected):
- expLine = exp.keys()[0]
+ expLine = list(exp.keys())[0]
isRegex = exp.values()[0]
if isRegex:
test.verify(re.match(expLine, line), "Verifying commit header line '%s'" % line)