summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-06-25 23:37:56 +0200
committerFlorian Bruhin <me@the-compiler.org>2023-06-30 19:29:28 +0200
commit729d7ce69de1035f7b8b630bece3d06895e050eb (patch)
treed18efd097370d50a154a4341ca38f00ace6de23a
parent67e3826e9a73a3901558586ff5735e86cbbce513 (diff)
downloadqutebrowser-729d7ce69de1035f7b8b630bece3d06895e050eb.tar.gz
qutebrowser-729d7ce69de1035f7b8b630bece3d06895e050eb.zip
qt6: Widen env auto tests
-rw-r--r--tests/unit/test_qt_machinery.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/tests/unit/test_qt_machinery.py b/tests/unit/test_qt_machinery.py
index e455ba9ca..32f63043b 100644
--- a/tests/unit/test_qt_machinery.py
+++ b/tests/unit/test_qt_machinery.py
@@ -406,15 +406,34 @@ class TestInit:
):
machinery.init(args=empty_args)
+ @pytest.fixture(params=["auto", "", None])
+ def qt_auto_env(
+ self,
+ request: pytest.FixtureRequest,
+ monkeypatch: pytest.MonkeyPatch,
+ ):
+ """Trigger wrapper autoselection via environment variable.
+
+ Autoselection should be used in three scenarios:
+
+ - The environment variable is set to "auto".
+ - The environment variable is set to an empty string.
+ - The environment variable is not set at all.
+
+ We run test_none_available_*() for all three scenarios.
+ """
+ if request.param is None:
+ monkeypatch.delenv("QUTE_QT_WRAPPER", raising=False)
+ else:
+ monkeypatch.setenv("QUTE_QT_WRAPPER", request.param)
+
def test_none_available_implicit(
self,
stubs: Any,
modules: Dict[str, bool],
monkeypatch: pytest.MonkeyPatch,
- undo_init: None,
+ qt_auto_env: None,
):
- # FIXME:qt6 Also try without this once auto is default
- monkeypatch.setenv("QUTE_QT_WRAPPER", "auto")
stubs.ImportFake(modules, monkeypatch).patch()
message_lines = [
@@ -438,10 +457,8 @@ class TestInit:
modules: Dict[str, bool],
monkeypatch: pytest.MonkeyPatch,
empty_args: argparse.Namespace,
- undo_init: None,
+ qt_auto_env: None,
):
- # FIXME:qt6 Also try without this once auto is default
- monkeypatch.setenv("QUTE_QT_WRAPPER", "auto")
stubs.ImportFake(modules, monkeypatch).patch()
info = machinery.init(args=empty_args)
@@ -469,7 +486,6 @@ class TestInit:
true_vars: str,
explicit: bool,
empty_args: argparse.Namespace,
- undo_init: None,
):
info = machinery.SelectionInfo(
wrapper=selected_wrapper,