summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-28 15:56:14 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-28 15:57:48 +0100
commitfd429fd3a59b2f1b693bdc68d177e63c3254b822 (patch)
treee56165723cd0467ba5673a945187f0650c6e9373 /tests
parent0efdfd2f270ef34fa42808ffcb1e95dfd46b6049 (diff)
downloadqutebrowser-fd429fd3a59b2f1b693bdc68d177e63c3254b822.tar.gz
qutebrowser-fd429fd3a59b2f1b693bdc68d177e63c3254b822.zip
Add a warning if QTWEBENGINE_CHROMIUM_FLAGS is set
See #6065 (cherry picked from commit 38fec3726fc0aa518a3637574f7e3e0029df41d4)
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/config/test_qtargs.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/config/test_qtargs.py b/tests/unit/config/test_qtargs.py
index f560f7275..be27274e5 100644
--- a/tests/unit/config/test_qtargs.py
+++ b/tests/unit/config/test_qtargs.py
@@ -18,6 +18,7 @@
import sys
import os
+import logging
import pytest
@@ -552,3 +553,29 @@ class TestEnvVars:
monkeypatch.setattr(qtargs.objects, 'backend',
usertypes.Backend.QtWebKit)
qtargs.init_envvars()
+
+ @pytest.mark.parametrize('backend, value, expected', [
+ (usertypes.Backend.QtWebKit, None, None),
+ (usertypes.Backend.QtWebKit, '--test', None),
+
+ (usertypes.Backend.QtWebEngine, None, None),
+ (usertypes.Backend.QtWebEngine, '', "''"),
+ (usertypes.Backend.QtWebEngine, '--xyz', "'--xyz'"),
+ ])
+ def test_qtwe_flags_warning(self, monkeypatch, config_stub, caplog,
+ backend, value, expected):
+ monkeypatch.setattr(qtargs.objects, 'backend', backend)
+ if value is None:
+ monkeypatch.delenv('QTWEBENGINE_CHROMIUM_FLAGS', raising=False)
+ else:
+ monkeypatch.setenv('QTWEBENGINE_CHROMIUM_FLAGS', value)
+
+ with caplog.at_level(logging.WARNING):
+ qtargs.init_envvars()
+
+ if expected is None:
+ assert not caplog.messages
+ else:
+ assert len(caplog.messages) == 1
+ msg = caplog.messages[0]
+ assert msg.startswith(f'You have QTWEBENGINE_CHROMIUM_FLAGS={expected} set')