From 46efdb736f2796687db3ed4c6f02fcc4f00d54a6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 1 Jun 2020 14:54:36 +0200 Subject: Add test for utils.libgl_workaround() --- qutebrowser/utils/utils.py | 2 +- tests/unit/utils/test_utils.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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. -- cgit v1.2.3-54-g00ecf