summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-07-27 11:26:51 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-07-27 19:26:46 +1000
commit03ecaa6b5337a4a34467202c04523c9f5334dbf3 (patch)
treed8552444b5e692625628f80af9744a408bcdc3cd /test
parentfcc6b28f5fdf582b48124fbd9190e78fab496839 (diff)
downloadxorg-lib-libxkbcommon-03ecaa6b5337a4a34467202c04523c9f5334dbf3.tar.gz
test: ignore the real XDG_CONFIG_HOME during tests
Let's not have our tests fail if the user has an incompatible $XDG_CONFIG_HOME/xkb directory. libxkbcommon has fallbacks when XDG_CONFIG_HOME isn't set so we need to override this with a real directory instead of just unsetting it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rwxr-xr-xtest/tool-option-parsing.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/tool-option-parsing.py b/test/tool-option-parsing.py
index df4ff77..c503176 100755
--- a/test/tool-option-parsing.py
+++ b/test/tool-option-parsing.py
@@ -27,6 +27,7 @@ import resource
import sys
import subprocess
import logging
+import tempfile
try:
import pytest
@@ -300,4 +301,10 @@ def test_interactive_wayland(xkbcli_interactive_wayland):
if __name__ == '__main__':
- sys.exit(pytest.main(args=[__file__]))
+ with tempfile.TemporaryDirectory() as tmpdir:
+ # libxkbcommon has fallbacks when XDG_CONFIG_HOME isn't set so we need
+ # to override it with a known (empty) directory. Otherwise our test
+ # behavior depends on the system the test is run on.
+ os.environ['XDG_CONFIG_HOME'] = tmpdir
+
+ sys.exit(pytest.main(args=[__file__]))