summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2023-05-08 18:12:33 +0200
committerRobert Löhning <robert.loehning@qt.io>2023-05-15 14:12:17 +0000
commit0b241f42f186e13b70550c070d3d271c1eb9e989 (patch)
tree4cdf8835779ae41e99242c84383b751356ad4f3f
parenta820b5490c4eb09b4b957e96d56b13ebf479f0e3 (diff)
downloadqt-creator-0b241f42f186e13b70550c070d3d271c1eb9e989.tar.gz
SquishTests: Make suite_tools Python3 compatible
Except for tst_designer_edit which needs a bigger update. Change-Id: I8300a9491ec34b4d8deeed39f02fc59281cc20c9 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--tests/system/suite_tools/tst_codepasting/test.py14
-rw-r--r--tests/system/suite_tools/tst_git_local/test.py5
2 files changed, 11 insertions, 8 deletions
diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py
index 148052a804..ec0d9ee226 100644
--- a/tests/system/suite_tools/tst_codepasting/test.py
+++ b/tests/system/suite_tools/tst_codepasting/test.py
@@ -72,7 +72,7 @@ def pasteFile(sourceFile, protocol):
try:
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
waitFor("re.search('^https://', str(outputWindow.plainText)) is not None", 20000)
- output = filter(lambda x: len(x), str(outputWindow.plainText).splitlines())[-1]
+ output = list(filter(lambda x: len(x), str(outputWindow.plainText).splitlines()))[-1]
except:
output = ""
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
@@ -126,10 +126,11 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting):
waitFor("pasteModel.rowCount() == 1", 1000)
waitFor("pasteModel.rowCount() > 1", 20000)
if pasteId == invalidPasteId(protocol):
- try:
- pasteLine = filter(lambda str:description in str, dumpItems(pasteModel))[0]
- pasteId = pasteLine.split(" ", 1)[0]
- except:
+ for currentItem in dumpItems(pasteModel):
+ if description in currentItem:
+ pasteId = currentItem.split(" ", 1)[0]
+ break
+ if pasteId == invalidPasteId(protocol):
test.fail("Could not find description line in list of pastes from %s" % protocol)
clickButton(waitForObject(":PasteSelectDialog.Cancel_QPushButton"))
return pasteId
@@ -242,7 +243,8 @@ def main():
# QString QTextCursor::selectedText () const:
# "Note: If the selection obtained from an editor spans a line break, the text will contain a
# Unicode U+2029 paragraph separator character instead of a newline \n character."
- selectedText = str(editor.textCursor().selectedText()).replace(unichr(0x2029), "\n")
+ newParagraph = chr(0x2029) if sys.version_info.major > 2 else unichr(0x2029)
+ selectedText = str(editor.textCursor().selectedText()).replace(newParagraph, "\n")
invokeMenuItem("Tools", "Code Pasting", "Paste Snippet...")
test.compare(waitForObject(":stackedWidget.plainTextEdit_QPlainTextEdit").plainText,
selectedText, "Verify that dialog shows selected text from the editor")
diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py
index 07208367fd..ab36b86b25 100644
--- a/tests/system/suite_tools/tst_git_local/test.py
+++ b/tests/system/suite_tools/tst_git_local/test.py
@@ -65,7 +65,8 @@ def __clickCommit__(count):
# find commit
try:
# Commits are listed in reverse chronologic order, so we have to invert count
- line = filter(lambda line: line.startswith("commit"), content.splitlines())[-count].strip()
+ line = list(filter(lambda line: line.startswith("commit"),
+ content.splitlines()))[-count].strip()
commit = line.split(" ", 1)[1]
except:
test.fail("Could not find the %d. commit - leaving test" % count)
@@ -90,7 +91,7 @@ def __clickCommit__(count):
{"Committer: %s, %s" % (id, time): True}]
for line, exp in zip(show.splitlines(), expected):
expLine = list(exp.keys())[0]
- isRegex = exp.values()[0]
+ isRegex = list(exp.values())[0]
if isRegex:
test.verify(re.match(expLine, line), "Verifying commit header line '%s'" % line)
else: