From a43c2068935803e559457f225031d97d68b00b4b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 27 Nov 2015 14:39:33 +0100 Subject: [PATCH] Mark some caret tests as xfail on Windows/OS X. See #1142. --- pytest.ini | 2 ++ tests/integration/features/caret.feature | 17 +++++++++++++++++ tests/integration/features/conftest.py | 24 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/pytest.ini b/pytest.ini index 81826c4e7..3dcf09232 100644 --- a/pytest.ini +++ b/pytest.ini @@ -11,6 +11,8 @@ markers = not_xvfb: Tests which can't be run with Xvfb. frozen: Tests which can only be run if sys.frozen is True. integration: Tests which test a bigger portion of code, run without coverage. + xfail_issue1142_osx: https://github.com/The-Compiler/qutebrowser/issues/1142 (OS X) + xfail_issue1142_windows: https://github.com/The-Compiler/qutebrowser/issues/1142 (Windows) flakes-ignore = UnusedImport UnusedVariable diff --git a/tests/integration/features/caret.feature b/tests/integration/features/caret.feature index 79faae189..2c95e2853 100644 --- a/tests/integration/features/caret.feature +++ b/tests/integration/features/caret.feature @@ -18,6 +18,7 @@ Feature: Caret mode four five six vier fünf sechs + @xfail_issue1142_windows Scenario: Moving to end and to start of document When I run :move-to-end-of-document And I run :move-to-start-of-document @@ -48,6 +49,7 @@ Feature: Caret mode one two three eins zwei drei + @xfail_issue1142_osx Scenario: Moving back to the end of previous block (with selection) When I run :move-to-end-of-next-block with count 2 And I run :toggle-selection @@ -59,6 +61,7 @@ Feature: Caret mode four five six + @xfail_issue1142_windows Scenario: Moving back to the end of previous block When I run :move-to-end-of-next-block with count 2 And I run :move-to-end-of-prev-block @@ -85,12 +88,14 @@ Feature: Caret mode And I run :yank-selected Then the clipboard should contain "eins " + @xfail_issue1142_osx Scenario: Moving to the start of next block (with selection) When I run :toggle-selection And I run :move-to-start-of-next-block And I run :yank-selected Then the clipboard should contain "one two three\n" + @xfail_issue1142_windows Scenario: Moving to the start of next block When I run :move-to-start-of-next-block And I run :toggle-selection @@ -106,6 +111,7 @@ Feature: Caret mode And I run :yank-selected Then the clipboard should contain "one two three" + @xfail_issue1142_windows Scenario: Moving and selecting a line When I run :move-to-next-line And I run :toggle-selection @@ -113,12 +119,14 @@ Feature: Caret mode And I run :yank-selected Then the clipboard should contain "eins zwei drei" + @xfail_issue1142_windows Scenario: Selecting next line When I run :toggle-selection And I run :move-to-next-line And I run :yank-selected Then the clipboard should contain "one two three\n" + @xfail_issue1142_windows Scenario: Moving to end and to start of line When I run :move-to-end-of-line And I run :move-to-start-of-line @@ -151,12 +159,14 @@ Feature: Caret mode # word + @xfail_issue1142_windows Scenario: Selecting a word When I run :toggle-selection And I run :move-to-end-of-word And I run :yank-selected Then the clipboard should contain "one" + @xfail_issue1142_windows Scenario: Moving to end and selecting a word When I run :move-to-end-of-word And I run :toggle-selection @@ -171,6 +181,7 @@ Feature: Caret mode And I run :yank-selected Then the clipboard should contain "two" + @xfail_issue1142_windows Scenario: Moving to next word and selecting until next word When I run :move-to-next-word And I run :toggle-selection @@ -178,6 +189,7 @@ Feature: Caret mode And I run :yank-selected Then the clipboard should contain "two " + @xfail_issue1142_windows Scenario: Moving to previous word and selecting a word When I run :move-to-end-of-word And I run :toggle-selection @@ -185,6 +197,7 @@ Feature: Caret mode And I run :yank-selected Then the clipboard should contain "one" + @xfail_issue1142_windows Scenario: Moving to previous word When I run :move-to-end-of-word And I run :move-to-prev-word @@ -208,6 +221,7 @@ Feature: Caret mode And I run :yank-selected Then the clipboard should contain "n" + @xfail_issue1142_windows Scenario: Selecting previous char When I run :move-to-end-of-word And I run :toggle-selection @@ -215,6 +229,7 @@ Feature: Caret mode And I run :yank-selected Then the clipboard should contain "e" + @xfail_issue1142_windows Scenario: Moving to previous char When I run :move-to-end-of-word And I run :move-to-prev-char @@ -229,6 +244,7 @@ Feature: Caret mode When I run :yank-selected Then the message "Nothing to yank" should be shown. + @xfail_issue1142_windows Scenario: :yank-selected message When I run :toggle-selection And I run :move-to-end-of-word @@ -249,6 +265,7 @@ Feature: Caret mode Then the message "3 chars yanked to primary selection" should be shown. And the primary selection should contain "one" + @xfail_issue1142_windows Scenario: :yank-selected with --keep When I run :toggle-selection And I run :move-to-end-of-word diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index b8131e46b..3e9b6f0ba 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -19,7 +19,9 @@ """Steps for bdd-like tests.""" +import os import re +import sys import time import json import os.path @@ -45,6 +47,28 @@ def _clipboard_mode(qapp, what): raise AssertionError +def pytest_collection_modifyitems(items): + """Handle markers for xfail caret tests on OS X/Windows. + + See https://github.com/The-Compiler/qutebrowser/issues/1142 + + We need to do this this way because we can't use markers with arguments + inside feature files. + """ + osx_xfail_marker = pytest.mark.xfail( + sys.platform == 'darwin', + reason='https://github.com/The-Compiler/qutebrowser/issues/1142') + windows_xfail_marker = pytest.mark.xfail( + os.name == 'nt', + reason='https://github.com/The-Compiler/qutebrowser/issues/1142') + + for item in items: + if item.get_marker('xfail_issue1142_osx'): + item.add_marker(osx_xfail_marker) + if item.get_marker('xfail_issue1142_windows'): + item.add_marker(windows_xfail_marker) + + ## Given