aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2024-04-15 08:33:39 +0200
committerEike Ziller <eike.ziller@qt.io>2024-04-15 08:33:39 +0200
commit310d3cc041f5617adef10d37605264fda2eda6d3 (patch)
tree8483160745ce72fd2983fe8ad4f4359a98c0b2df /tests
parent559c57e29c7fd441f3f859c24f3e1483101ded5d (diff)
parent25d6c4f4e902e43a2a36e054594cfa16941051fd (diff)
Merge remote-tracking branch 'origin/13.0'
Conflicts: src/plugins/remotelinux/linuxdevice.cpp Change-Id: Iad28a1bfa4632922931d351d2fe27757cf21dec3
Diffstat (limited to 'tests')
-rw-r--r--tests/system/shared/classes.py7
-rw-r--r--tests/system/shared/project.py2
-rw-r--r--tests/system/shared/qtcreator.py6
-rw-r--r--tests/system/shared/utils.py19
-rw-r--r--tests/system/suite_editors/tst_revert_changes/test.py2
-rw-r--r--tests/system/suite_general/tst_cmake_speedcrunch/test.py4
-rw-r--r--tests/system/suite_general/tst_rename_file/test.py7
-rw-r--r--tests/system/suite_qtquick/tst_qml_outline/test.py2
-rw-r--r--tests/system/suite_tools/tst_codepasting/test.py2
9 files changed, 23 insertions, 28 deletions
diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py
index dcc702295b..4611a0cefe 100644
--- a/tests/system/shared/classes.py
+++ b/tests/system/shared/classes.py
@@ -1,10 +1,7 @@
# Copyright (C) 2016 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-try:
- import __builtin__ # Python 2
-except ImportError:
- import builtins as __builtin__ # Python 3
+import builtins
# for easier re-usage (because Python hasn't an enum type)
class Targets:
@@ -128,7 +125,7 @@ class QtPath:
@staticmethod
def toVersionTuple(versionString):
- return tuple(map(__builtin__.int, versionString.split(".")))
+ return tuple(map(builtins.int, versionString.split(".")))
@staticmethod
def getQtVersion(target):
diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py
index 00641e465b..a45d78cfc4 100644
--- a/tests/system/shared/project.py
+++ b/tests/system/shared/project.py
@@ -603,7 +603,7 @@ def __writeProjectTreeFile__(projectTree, filename):
def __getTestData__(record):
return [testData.field(record, "text"),
- __builtin__.int(testData.field(record, "nestinglevel"))]
+ builtins.int(testData.field(record, "nestinglevel"))]
def compareProjectTree(rootObject, dataset):
root = waitForObject(rootObject)
diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py
index e97c0b025f..f1d4078fb5 100644
--- a/tests/system/shared/qtcreator.py
+++ b/tests/system/shared/qtcreator.py
@@ -12,11 +12,7 @@ import subprocess;
import sys
import errno;
from datetime import datetime,timedelta;
-if sys.version_info.major > 2:
- import builtins as __builtin__
-else:
- import __builtin__
-
+import builtins
srcPath = ''
SettingsPath = []
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index b922b24a79..afb609292c 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -71,15 +71,15 @@ def verifyEnabled(objectSpec, expectedState = True):
# param itemName is the item to be selected in the combo box
# returns True if selection was changed or False if the wanted value was already selected
def selectFromCombo(objectSpec, itemName):
- object = verifyEnabled(objectSpec)
- if itemName == str(object.currentText):
+ comboObject = verifyEnabled(objectSpec)
+ if itemName == str(comboObject.currentText):
return False
else:
- mouseClick(object)
+ mouseClick(comboObject)
snooze(1)
# params required here
- mouseClick(waitForObjectItem(object, itemName.replace(".", "\\.")), 5, 5, 0, Qt.LeftButton)
- test.verify(waitFor("str(object.currentText)==itemName", 5000),
+ mouseClick(waitForObjectItem(comboObject, itemName.replace(".", "\\.")))
+ test.verify(waitFor("str(comboObject.currentText)==itemName", 5000),
"Switched combo item to '%s'" % itemName)
return True
@@ -588,15 +588,12 @@ def getHelpTitle():
def isString(sth):
- if sys.version_info.major > 2:
- return isinstance(sth, str)
- else:
- return isinstance(sth, (str, unicode))
+ return isinstance(sth, str)
+
# helper function to ensure we get str, converts bytes if necessary
def stringify(obj):
- stringTypes = (str, unicode) if sys.version_info.major == 2 else (str)
- if isinstance(obj, stringTypes):
+ if isString(obj):
return obj
if isinstance(obj, bytes):
if not platform.system() in ('Microsoft', 'Windows'):
diff --git a/tests/system/suite_editors/tst_revert_changes/test.py b/tests/system/suite_editors/tst_revert_changes/test.py
index 6ad06b1124..7774faed4b 100644
--- a/tests/system/suite_editors/tst_revert_changes/test.py
+++ b/tests/system/suite_editors/tst_revert_changes/test.py
@@ -33,7 +33,7 @@ def main():
__modifyFile__(fileName, modification)
test.log("Reverting all files...")
fileModifications = dict(zip(fileModifications.keys(),
- (__builtin__.bool(v) for v in fileModifications.values())))
+ (builtins.bool(v) for v in fileModifications.values())))
revertChanges(fileModifications)
invokeMenuItem("File", "Exit")
diff --git a/tests/system/suite_general/tst_cmake_speedcrunch/test.py b/tests/system/suite_general/tst_cmake_speedcrunch/test.py
index 4f75d43eb9..4761daaed1 100644
--- a/tests/system/suite_general/tst_cmake_speedcrunch/test.py
+++ b/tests/system/suite_general/tst_cmake_speedcrunch/test.py
@@ -12,8 +12,8 @@ def cmakeSupported():
versionLine = next(iter(versionLines))
test.log("Using " + versionLine)
matcher = re.match("cmake version (\d+)\.(\d+)\.\d+", versionLine)
- major = __builtin__.int(matcher.group(1))
- minor = __builtin__.int(matcher.group(2))
+ major = builtins.int(matcher.group(1))
+ minor = builtins.int(matcher.group(2))
except:
return False
diff --git a/tests/system/suite_general/tst_rename_file/test.py b/tests/system/suite_general/tst_rename_file/test.py
index 693303553a..d2abe87ea2 100644
--- a/tests/system/suite_general/tst_rename_file/test.py
+++ b/tests/system/suite_general/tst_rename_file/test.py
@@ -79,7 +79,12 @@ def renameFile(projectDir, proFile, branch, oldname, newname):
menu = ":Qt Creator.Project.Menu.Folder_QMenu"
else:
menu = ":Qt Creator.Project.Menu.File_QMenu"
- activateItem(waitForObjectItem(menu, "Rename..."))
+ try:
+ activateItem(waitForObjectItem(menu, "Rename...", 5000))
+ except:
+ # Try getting an enabled item by reopening the menu
+ openItemContextMenu(treeview, oldItemText, 5, 5, 0)
+ activateItem(waitForObjectItem(menu, "Rename...", 5000))
replaceEdit = waitForObject(":Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit")
test.compare(replaceEdit.selectedText, oldname.rsplit(".", 1)[0],
"Only the filename without the extension is selected?")
diff --git a/tests/system/suite_qtquick/tst_qml_outline/test.py b/tests/system/suite_qtquick/tst_qml_outline/test.py
index fb3662b805..5eb9ab3e33 100644
--- a/tests/system/suite_qtquick/tst_qml_outline/test.py
+++ b/tests/system/suite_qtquick/tst_qml_outline/test.py
@@ -104,7 +104,7 @@ def __writeOutlineFile__(outlinePseudoTree, filename):
def retrieveData(record):
return (testData.field(record, "element"),
- __builtin__.int(testData.field(record, "nestinglevel")),
+ builtins.int(testData.field(record, "nestinglevel")),
testData.field(record, "value"))
def verifyOutline(outlinePseudoTree, datasetFileName):
diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py
index ec0d9ee226..2720b336df 100644
--- a/tests/system/suite_tools/tst_codepasting/test.py
+++ b/tests/system/suite_tools/tst_codepasting/test.py
@@ -243,7 +243,7 @@ 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."
- newParagraph = chr(0x2029) if sys.version_info.major > 2 else unichr(0x2029)
+ newParagraph = chr(0x2029)
selectedText = str(editor.textCursor().selectedText()).replace(newParagraph, "\n")
invokeMenuItem("Tools", "Code Pasting", "Paste Snippet...")
test.compare(waitForObject(":stackedWidget.plainTextEdit_QPlainTextEdit").plainText,