diff options
author | Robert Loehning <robert.loehning@qt.io> | 2018-07-27 15:32:44 +0200 |
---|---|---|
committer | Robert Loehning <robert.loehning@qt.io> | 2018-07-30 13:04:31 +0000 |
commit | 7cc5376f0dbbcb2a2b8ba7e93373d9d4613e1e2d (patch) | |
tree | dd01c76cb8a87c52f4fba0152233f1fa95ce738e /tests/system/suite_tools/tst_codepasting/test.py | |
parent | 3f97874ca1056bca0baf8876466fbb8c8cd61971 (diff) |
Squish: Fix handling of server issues in tst_codepasting
Change-Id: I35d8dbeb11be104a1af2956125a29c4606c7e050
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests/system/suite_tools/tst_codepasting/test.py')
-rw-r--r-- | tests/system/suite_tools/tst_codepasting/test.py | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index 998b36bf84..160353b2c5 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -43,15 +43,20 @@ def invalidPasteId(protocol): return -1 def closeHTTPStatusAndPasterDialog(protocol, pasterDialog): - mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol - mBox = waitForObject(mBoxStr, 1000) - text = str(mBox.text) - # close message box and paster window - clickButton("{type='QPushButton' text='Cancel' visible='1' window=%s}" % mBoxStr) - clickButton("{type='QPushButton' text='Cancel' visible='1' window='%s'}" % pasterDialog) - if 'Service Unavailable' in text: - test.warning(text) - return True + try: + mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' windowTitle?='%s *'}" % protocol + mBox = waitForObject(mBoxStr, 1000) + text = str(mBox.text) + # close message box and paster window + clickButton("{type='QPushButton' text='Cancel' visible='1' window=%s}" % mBoxStr) + clickButton("{type='QPushButton' text='Cancel' visible='1' window='%s'}" % pasterDialog) + if 'Service Unavailable' in text: + test.warning(text) + 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) return False @@ -90,11 +95,9 @@ def pasteFile(sourceFile, protocol): output = str(outputWindow.plainText).splitlines()[-1] except: output = "" - try: - if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'): - raise Exception(serverProblems) - except: - pass + if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'): + resetFiles() + raise Exception(serverProblems) stdErrOut = aut.readStderr() match = re.search("^%s protocol error: (.*)$" % protocol, stdErrOut, re.MULTILINE) if match: @@ -123,11 +126,8 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting): try: pasteModel = waitForObject(":PasteSelectDialog.listWidget_QListWidget").model() except: - try: - if closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog'): - return -1 - except: - pass + closeHTTPStatusAndPasterDialog(protocol, ':PasteSelectDialog_CodePaster::PasteSelectDialog') + return -1 waitFor("pasteModel.rowCount() > 1", 20000) if (not skippedPasting and not protocol == NAME_PBCA and not any(map(lambda str:pasteId in str, dumpItems(pasteModel)))): |