summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-06-01 14:54:36 +0200
committerFlorian Bruhin <me@the-compiler.org>2020-06-01 14:54:36 +0200
commit46efdb736f2796687db3ed4c6f02fcc4f00d54a6 (patch)
treed4b826c058bc62432beb57731b709702823c6f15
parentfb6594be27be1da68352f64c4d0550254d9e5378 (diff)
downloadqutebrowser-46efdb736f2796687db3ed4c6f02fcc4f00d54a6.tar.gz
qutebrowser-46efdb736f2796687db3ed4c6f02fcc4f00d54a6.zip
Add test for utils.libgl_workaround()
-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.