SquishTests: Don't use lists of dicts

...when that doesn't have any advantages.

Change-Id: I0c58e30ae0b9e278e3336646332279f6243719d0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Löhning
2023-07-26 18:26:26 +02:00
parent b57f72e3c8
commit b95aba56b5
2 changed files with 18 additions and 20 deletions

View File

@@ -359,24 +359,22 @@ def __lowerStrs__(iterable):
def __checkCreatedSettings__(settingsFolder): def __checkCreatedSettings__(settingsFolder):
waitForCleanShutdown() waitForCleanShutdown()
qtProj = os.path.join(settingsFolder, "QtProject") qtProj = os.path.join(settingsFolder, "QtProject")
folders = [] creatorFolder = os.path.join(qtProj, "qtcreator")
files = [{os.path.join(qtProj, "QtCreator.db"):0}, folders = [creatorFolder,
{os.path.join(qtProj, "QtCreator.ini"):30}] os.path.join(creatorFolder, "generic-highlighter"),
folders.append(os.path.join(qtProj, "qtcreator")) os.path.join(creatorFolder, "macros")]
files.extend([{os.path.join(folders[0], "debuggers.xml"):0}, files = {os.path.join(qtProj, "QtCreator.db"):0,
{os.path.join(folders[0], "devices.xml"):0}, os.path.join(qtProj, "QtCreator.ini"):30,
{os.path.join(folders[0], "helpcollection.qhc"):0}, os.path.join(creatorFolder, "debuggers.xml"):0,
{os.path.join(folders[0], "profiles.xml"):0}, os.path.join(creatorFolder, "devices.xml"):0,
{os.path.join(folders[0], "qtversion.xml"):0}, os.path.join(creatorFolder, "helpcollection.qhc"):0,
{os.path.join(folders[0], "toolchains.xml"):0}]) os.path.join(creatorFolder, "profiles.xml"):0,
folders.extend([os.path.join(folders[0], "generic-highlighter"), os.path.join(creatorFolder, "qtversion.xml"):0,
os.path.join(folders[0], "macros")]) os.path.join(creatorFolder, "toolchains.xml"):0}
for f in folders: for f in folders:
test.verify(os.path.isdir(f), test.verify(os.path.isdir(f),
"Verifying whether folder '%s' has been created." % os.path.basename(f)) "Verifying whether folder '%s' has been created." % os.path.basename(f))
for f in files: for fName, fMinSize in files.items():
fName = next(iter(f.keys()))
fMinSize = next(iter(f.values()))
text = "created non-empty" text = "created non-empty"
if fMinSize > 0: if fMinSize > 0:
text = "modified" text = "modified"

View File

@@ -86,12 +86,12 @@ def __clickCommit__(count):
show = str(description.plainText) show = str(description.plainText)
id = "Nobody <nobody@nowhere\.com>" id = "Nobody <nobody@nowhere\.com>"
time = "\w{3} \w{3} \d{1,2} \d{2}:\d{2}:\d{2} \d{4}.* seconds ago\)" time = "\w{3} \w{3} \d{1,2} \d{2}:\d{2}:\d{2} \d{4}.* seconds ago\)"
expected = [{"commit %s" % commit:False}, expected = [["commit %s" % commit, False],
{"Author: %s, %s" % (id, time): True}, ["Author: %s, %s" % (id, time), True],
{"Committer: %s, %s" % (id, time): True}] ["Committer: %s, %s" % (id, time), True]]
for line, exp in zip(show.splitlines(), expected): for line, exp in zip(show.splitlines(), expected):
expLine = next(iter(exp.keys())) expLine = exp[0]
isRegex = next(iter(exp.values())) isRegex = exp[1]
if isRegex: if isRegex:
test.verify(re.match(expLine, line), "Verifying commit header line '%s'" % line) test.verify(re.match(expLine, line), "Verifying commit header line '%s'" % line)
else: else: