From 7fcfb9b6350bb5b5af6301affeb5dc63f4777196 Mon Sep 17 00:00:00 2001 From: Philipp Albrecht Date: Fri, 5 Nov 2021 15:50:41 +0100 Subject: Enable overriding of backend auto-detection One can override the auto-detection mechanism by passing the backend via --qute-bdd-backend= or by setting the environment variable QUTE_BDD_BACKEND=. --- tests/conftest.py | 11 ++++++----- tests/end2end/conftest.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index beab14a52..120c6a0f5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -214,8 +214,8 @@ def pytest_addoption(parser): help="Delay between qutebrowser commands.") parser.addoption('--qute-profile-subprocs', action='store_true', default=False, help="Run cProfile for subprocesses.") - parser.addoption('--qute-bdd-webengine', action='store_true', - help='Use QtWebEngine for BDD tests') + parser.addoption('--qute-bdd-backend', action='store', + choices=['webkit', 'webengine'], help='Set backend for BDD tests') def pytest_configure(config): @@ -229,9 +229,10 @@ def pytest_configure(config): 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' or + webengine_arg = config.getoption('--qute-bdd-backend') + webengine_env = os.environ.get('QUTE_BDD_BACKEND') + config.webengine = (webengine_arg == 'webengine' or + webengine_env == 'webengine' or config.backend == 'webengine') earlyinit.configure_pyqt() diff --git a/tests/end2end/conftest.py b/tests/end2end/conftest.py index a4a089cea..563c380f2 100644 --- a/tests/end2end/conftest.py +++ b/tests/end2end/conftest.py @@ -165,7 +165,7 @@ if not getattr(sys, 'frozen', False): def pytest_collection_modifyitems(config, items): - """Apply @qtwebengine_* markers; skip unittests with QUTE_BDD_WEBENGINE.""" + """Apply @qtwebengine_* markers; skip unittests with QUTE_BDD_BACKEND=webengine.""" # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-75884 # (note this isn't actually fixed properly before Qt 5.15) header_bug_fixed = qtutils.version_check('5.15', compiled=False) -- cgit v1.2.3-54-g00ecf