summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qutebrowser/utils/utils.py2
-rw-r--r--tests/unit/utils/test_utils.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py
index ccae5a5d3..92ca34a08 100644
--- a/qutebrowser/utils/utils.py
+++ b/qutebrowser/utils/utils.py
@@ -789,5 +789,5 @@ def libgl_workaround() -> None:
return
libgl = ctypes.util.find_library("GL")
- if libgl is not None:
+ if libgl is not None: # pragma: no branch
ctypes.CDLL(libgl, mode=ctypes.RTLD_GLOBAL)
diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py
index 18abd444e..35f04201e 100644
--- a/tests/unit/utils/test_utils.py
+++ b/tests/unit/utils/test_utils.py
@@ -885,3 +885,10 @@ def test_ceil_log_invalid(number, base):
math.log(number, base)
with pytest.raises(ValueError):
utils.ceil_log(number, base)
+
+
+@pytest.mark.parametrize('skip', [True, False])
+def test_libgl_workaround(monkeypatch, skip):
+ if skip:
+ monkeypatch.setenv('QUTE_SKIP_LIBGL_WORKAROUND', '1')
+ utils.libgl_workaround() # Just make sure it doesn't crash.