Use importorskip to skip stylesheet tests on webkit only systems

This commit is contained in:
Jay Kamat 2017-11-15 02:05:34 -05:00
parent 28572ce3b1
commit 92a6e61b52
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5

View File

@ -22,11 +22,8 @@
import os import os
import pytest import pytest
try: QtWebEngineWidgets = pytest.importorskip("PyQt5.QtWebEngineWidgets")
from PyQt5.QtWebEngineWidgets import QWebEngineProfile QWebEngineProfile = QtWebEngineWidgets.QWebEngineProfile
except ImportError:
QWebEngineProfile = None
from qutebrowser.utils import javascript from qutebrowser.utils import javascript
@ -59,8 +56,6 @@ class StylesheetTester:
"""Initialize the stylesheet with a provided css file.""" """Initialize the stylesheet with a provided css file."""
css_path = os.path.join(os.path.dirname(__file__), css_file) css_path = os.path.join(os.path.dirname(__file__), css_file)
self.config_stub.val.content.user_stylesheets = css_path self.config_stub.val.content.user_stylesheets = css_path
if QWebEngineProfile is None:
pytest.skip("QTWebEngine not found.")
p = QWebEngineProfile.defaultProfile() p = QWebEngineProfile.defaultProfile()
webenginesettings._init_stylesheet(p) webenginesettings._init_stylesheet(p)