forked from qt-creator/qt-creator
Squish: Fix handling of server issues in tst_codepasting
Change-Id: I35d8dbeb11be104a1af2956125a29c4606c7e050 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -43,6 +43,7 @@ def invalidPasteId(protocol):
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
def closeHTTPStatusAndPasterDialog(protocol, pasterDialog):
|
def closeHTTPStatusAndPasterDialog(protocol, pasterDialog):
|
||||||
|
try:
|
||||||
mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol
|
mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol
|
||||||
mBox = waitForObject(mBoxStr, 1000)
|
mBox = waitForObject(mBoxStr, 1000)
|
||||||
text = str(mBox.text)
|
text = str(mBox.text)
|
||||||
@@ -52,6 +53,10 @@ def closeHTTPStatusAndPasterDialog(protocol, pasterDialog):
|
|||||||
if 'Service Unavailable' in text:
|
if 'Service Unavailable' in text:
|
||||||
test.warning(text)
|
test.warning(text)
|
||||||
return True
|
return True
|
||||||
|
except:
|
||||||
|
t,v = sys.exc_info()[:2]
|
||||||
|
test.warning("An exception occurred in closeHTTPStatusAndPasterDialog(): %s(%s)"
|
||||||
|
% (str(t), str(v)))
|
||||||
test.log("Closed dialog without expected error.", text)
|
test.log("Closed dialog without expected error.", text)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -90,11 +95,9 @@ def pasteFile(sourceFile, protocol):
|
|||||||
output = str(outputWindow.plainText).splitlines()[-1]
|
output = str(outputWindow.plainText).splitlines()[-1]
|
||||||
except:
|
except:
|
||||||
output = ""
|
output = ""
|
||||||
try:
|
|
||||||
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
|
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
|
||||||
|
resetFiles()
|
||||||
raise Exception(serverProblems)
|
raise Exception(serverProblems)
|
||||||
except:
|
|
||||||
pass
|
|
||||||
stdErrOut = aut.readStderr()
|
stdErrOut = aut.readStderr()
|
||||||
match = re.search("^%s protocol error: (.*)$" % protocol, stdErrOut, re.MULTILINE)
|
match = re.search("^%s protocol error: (.*)$" % protocol, stdErrOut, re.MULTILINE)
|
||||||
if match:
|
if match:
|
||||||
@@ -123,11 +126,8 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting):
|
|||||||
try:
|
try:
|
||||||
pasteModel = waitForObject(":PasteSelectDialog.listWidget_QListWidget").model()
|
pasteModel = waitForObject(":PasteSelectDialog.listWidget_QListWidget").model()
|
||||||
except:
|
except:
|
||||||
try:
|
closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog')
|
||||||
if closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog'):
|
|
||||||
return -1
|
return -1
|
||||||
except:
|
|
||||||
pass
|
|
||||||
waitFor("pasteModel.rowCount() > 1", 20000)
|
waitFor("pasteModel.rowCount() > 1", 20000)
|
||||||
if (not skippedPasting and not protocol == NAME_PBCA
|
if (not skippedPasting and not protocol == NAME_PBCA
|
||||||
and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))):
|
and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))):
|
||||||
|
Reference in New Issue
Block a user