From 92a6e61b5226ed25a6d133920c4b9f0e4418bc47 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Wed, 15 Nov 2017 02:05:34 -0500 Subject: [PATCH] Use importorskip to skip stylesheet tests on webkit only systems --- tests/unit/javascript/stylesheet/test_stylesheet.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/unit/javascript/stylesheet/test_stylesheet.py b/tests/unit/javascript/stylesheet/test_stylesheet.py index 83c9cbf98..7070cfceb 100644 --- a/tests/unit/javascript/stylesheet/test_stylesheet.py +++ b/tests/unit/javascript/stylesheet/test_stylesheet.py @@ -22,11 +22,8 @@ import os import pytest -try: - from PyQt5.QtWebEngineWidgets import QWebEngineProfile -except ImportError: - QWebEngineProfile = None - +QtWebEngineWidgets = pytest.importorskip("PyQt5.QtWebEngineWidgets") +QWebEngineProfile = QtWebEngineWidgets.QWebEngineProfile from qutebrowser.utils import javascript @@ -59,8 +56,6 @@ class StylesheetTester: """Initialize the stylesheet with a provided css file.""" css_path = os.path.join(os.path.dirname(__file__), css_file) self.config_stub.val.content.user_stylesheets = css_path - if QWebEngineProfile is None: - pytest.skip("QTWebEngine not found.") p = QWebEngineProfile.defaultProfile() webenginesettings._init_stylesheet(p)