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',
}
raise WaitForClipboardTimeout(
"Timed out after {}ms waiting for {} in {} (clipboard: {!r}, "
"primary {!r}).".format(
timeout, expected, mode_names[mode],
clipboard.text(mode=QClipboard.Clipboard),
clipboard.text(mode=QClipboard.Selection))
"Timed out after {timeout}ms waiting for {what}:\n"
" expected: {expected!r}\n"
" clipboard: {clipboard!r}\n"
" primary: {primary!r}.".format(
timeout=timeout, what=mode_names[mode],
expected=expected,
clipboard=clipboard.text(mode=QClipboard.Clipboard),
primary=clipboard.text(mode=QClipboard.Selection))
)