From 43b2935e52b09e1508aef3b4f6aa14088603daea Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 28 Aug 2022 20:45:29 +0530 Subject: [PATCH] Make fish shell integration test for XDG_DATA_DIRS work even if the shells rc files add to XDG_DATA_DIRS. My Linux distro has now started installing system wide rc files that do this :(( --- kitty_tests/shell_integration.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kitty_tests/shell_integration.py b/kitty_tests/shell_integration.py index 9d758e3e9..3ef2bdfc4 100644 --- a/kitty_tests/shell_integration.py +++ b/kitty_tests/shell_integration.py @@ -11,7 +11,7 @@ import unittest from contextlib import contextmanager from functools import lru_cache, partial -from kitty.constants import kitty_base_dir, terminfo_dir +from kitty.constants import kitty_base_dir, terminfo_dir, shell_integration_dir from kitty.fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE from kitty.shell_integration import ( setup_bash_env, setup_fish_env, setup_zsh_env @@ -174,10 +174,9 @@ function _set_status_prompt; function fish_prompt; echo -n "$pipestatus $status pty.wait_till(lambda: pty.screen_contents().count(right_prompt) == 1) self.ae(pty.screen_contents(), q) - # XDG_DATA_DIRS - pty.send_cmd_to_child('set -q XDG_DATA_DIRS; or echo ok') - pty.wait_till(lambda: pty.screen_contents().count(right_prompt) == 2) - self.ae(str(pty.screen.line(1)), 'ok') + # shell integration dir must no be in XDG_DATA_DIRS + pty.send_cmd_to_child(f'string match -q -- "*{shell_integration_dir}*" "$XDG_DATA_DIRS" || echo "XDD_OK"') + pty.wait_till(lambda: 'XDD_OK' in pty.screen_contents()) # CWD reporting self.assertTrue(pty.screen.last_reported_cwd.endswith(self.home_dir))