Add test for utils.libgl_workaround()

This commit is contained in:
Florian Bruhin 2020-06-01 14:54:36 +02:00
parent fb6594be27
commit 46efdb736f
2 changed files with 8 additions and 1 deletions

View File

@ -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)

View File

@ -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.