tests: Improve WaitForClipboardTimeout message.

This commit is contained in:
Florian Bruhin 2016-01-08 08:35:34 +01:00
parent 0d9cbba3b9
commit eef1604dcd

View File

@ -403,11 +403,14 @@ def _wait_for_clipboard(qtbot, clipboard, mode, expected):
QClipboard.Selection: 'primary selection', QClipboard.Selection: 'primary selection',
} }
raise WaitForClipboardTimeout( raise WaitForClipboardTimeout(
"Timed out after {}ms waiting for {} in {} (clipboard: {!r}, " "Timed out after {timeout}ms waiting for {what}:\n"
"primary {!r}).".format( " expected: {expected!r}\n"
timeout, expected, mode_names[mode], " clipboard: {clipboard!r}\n"
clipboard.text(mode=QClipboard.Clipboard), " primary: {primary!r}.".format(
clipboard.text(mode=QClipboard.Selection)) timeout=timeout, what=mode_names[mode],
expected=expected,
clipboard=clipboard.text(mode=QClipboard.Clipboard),
primary=clipboard.text(mode=QClipboard.Selection))
) )