From 39f29e2531ee7c96d24f524519c4811533403fad Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 23 Nov 2015 16:29:37 +0100 Subject: [PATCH] tests: Wait until clipboard actually changed. Hopefully fixes #1124. --- tests/integration/features/test_yankpaste.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/integration/features/test_yankpaste.py b/tests/integration/features/test_yankpaste.py index 66375c94d..f85f41939 100644 --- a/tests/integration/features/test_yankpaste.py +++ b/tests/integration/features/test_yankpaste.py @@ -31,13 +31,16 @@ pytestmark = pytest.mark.qt_log_ignore( '^QXcbClipboard: SelectionRequest too old', extend=True) @pytest.fixture(autouse=True) -def skip_with_broken_clipboard(qapp): +def skip_with_broken_clipboard(qtbot, qapp): """The clipboard seems to be broken on some platforms (OS X Yosemite?). This skips the tests if this is the case. """ clipboard = qapp.clipboard() - clipboard.setText("Does this work?") + + with qtbot.waitSignal(clipboard.changed): + clipboard.setText("Does this work?") + if clipboard.text() != "Does this work?": pytest.skip("Clipboard seems to be broken on this platform.") @@ -60,10 +63,13 @@ def selection_supported(qapp): @bdd.when(bdd.parsers.re(r'I put "(?P.*)" into the ' r'(?Pprimary selection|clipboard)')) -def fill_clipboard(qapp, httpbin, what, content): +def fill_clipboard(qtbot, qapp, httpbin, what, content): mode = _get_mode(qapp, what) content = content.replace('(port)', str(httpbin.port)) - qapp.clipboard().setText(content, mode) + + clipboard = qapp.clipboard() + with qtbot.waitSignal(clipboard.changed): + clipboard.setText(content, mode) @bdd.then(bdd.parsers.re(r'the (?Pprimary selection|clipboard) should '