test/tool-option-parsing: keep isolated by using our own test data
authorRan Benita <ran@unusedvar.com>
Mon, 7 Sep 2020 08:10:19 +0000 (11:10 +0300)
committerRan Benita <ran@unusedvar.com>
Mon, 7 Sep 2020 19:06:22 +0000 (22:06 +0300)
Make it possible to run the test on all machines.

Signed-off-by: Ran Benita <ran@unusedvar.com>
test/tool-option-parsing.py

index 367e799..3863be1 100755 (executable)
@@ -37,6 +37,7 @@ except ImportError:
 
 
 top_builddir = os.environ['top_builddir']
+top_srcdir = os.environ['top_srcdir']
 
 logging.basicConfig(level=logging.DEBUG)
 logger = logging.getLogger('test')
@@ -45,7 +46,7 @@ logger.setLevel(logging.DEBUG)
 # Permutation of RMLVO that we use in multiple tests
 rmlvos = [list(x) for x in itertools.permutations(
     ['--rules=evdev', '--model=pc104',
-     '--layout=fr', '--options=eurosign:5']
+     '--layout=ch', '--options=eurosign:5']
 )]
 
 
@@ -302,10 +303,14 @@ def test_interactive_wayland(xkbcli_interactive_wayland):
 
 if __name__ == '__main__':
     with tempfile.TemporaryDirectory() as tmpdir:
+        # Use our own test xkeyboard-config copy.
+        os.environ['XKB_CONFIG_ROOT'] = top_srcdir + '/test/data'
         # 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
+        # Prevent the legacy $HOME/.xkb from kicking in.
+        del os.environ['HOME']
         # This needs to be separated if we do specific extra path testing
         os.environ['XKB_CONFIG_EXTRA_PATH'] = tmpdir