diff options
author | Philipp Albrecht <philipp.albrecht@momox.biz> | 2021-11-05 14:34:31 +0100 |
---|---|---|
committer | Philipp Albrecht <philipp.albrecht@momox.biz> | 2021-11-05 15:30:02 +0100 |
commit | 21055a39fcca455fafcdfa7eeadee466be8f472b (patch) | |
tree | 0c602a4ac4299ac26013e5ee2b012647efbbb24c | |
parent | dafe9f6966132ae48b16347538a6210ca1010f6c (diff) | |
download | qutebrowser-21055a39fcca455fafcdfa7eeadee466be8f472b.tar.gz qutebrowser-21055a39fcca455fafcdfa7eeadee466be8f472b.zip |
Set config.backend in pytest_configure()
For now this just serves the purpose of making the information available
to the pytest_report_header() hook, where we want to report, which
backend is used when running tests.
-rw-r--r-- | tests/conftest.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 40631af34..c00fcf6bf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -219,6 +219,16 @@ def pytest_addoption(parser): def pytest_configure(config): + try: + # Try to use QtWebkit as the default backend + import PyQt5.QtWebKitWidgets + config.backend = 'webkit' + except ImportError: + # Try to use QtWebEngine as a fallback and fail early + # if that's also not available + import PyQt5.QtWebEngineWidgets + config.backend = 'webengine' + webengine_arg = config.getoption('--qute-bdd-webengine') webengine_env = os.environ.get('QUTE_BDD_WEBENGINE', 'false') config.webengine = webengine_arg or webengine_env == 'true' |