jenkins-bot has submitted this change and it was merged.
Change subject: ui_tests: limit retries in testOutputUnicodeText_no_transliterate ......................................................................
ui_tests: limit retries in testOutputUnicodeText_no_transliterate
The old code could loop infinitly. The maximum number of retries is now limited to 3 (= at least 3 seconds) which should be enough for all practical purposes.
The test was adapted from requiring 'Alpha' on the first line to requiring 'Alpha' somewhere in the return value, as output before the first expected line is a regular issue.
In addition, changed incorrect ctrl-L to alt-L to select the font selector. This still probably only works for a Dutch Windows version, so we might want to consider doing this either manually or with a direct Win32 API function (assuming we won't test on WinXP)
Change-Id: I87e40f0c200a5cbd181df5e4112055e38650414a --- M tests/ui_tests.py 1 file changed, 10 insertions(+), 2 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/ui_tests.py b/tests/ui_tests.py index e47fdbe..138afb2 100644 --- a/tests/ui_tests.py +++ b/tests/ui_tests.py @@ -544,7 +544,7 @@ % e)
try: - window.TypeKeys('% {UP}{ENTER}^L{HOME}L{ENTER}', with_spaces=True) + window.TypeKeys('% {UP}{ENTER}%L{HOME}L{ENTER}', with_spaces=True) except Exception as e: cls.tearDownProcess() raise unittest.SkipTest('Windows package pywinauto could not use window TypeKeys: %r' @@ -666,8 +666,16 @@ u"pywikibot.output(u'\n'.join(pywikibot.handleArgs()))" " u"Alpha Bετα Гамма دلتا\n") lines = [] - while len(lines) < 4 or lines[0] != 'Alpha': + + for i in range(3): lines = self.getstdouterr().split('\n') + if len(lines) >= 4 and 'Alpha' not in lines: + # if len(lines) < 4, we assume not all lines had been output + # yet, and retry. We check at least one of the lines contains + # "Alpha" to prevent using older clipboard content. We limit + # the number of retries to 3 so that the test will finish even + # if neither of these requirements are met. + break time.sleep(1)
# empty line is the new command line