Ensure local kitty is used in tests even when another kitty is present in the system PATH

Fixes #5194
This commit is contained in:
Kovid Goyal 2022-06-14 21:08:58 +05:30
parent 646a524c8e
commit a7c65efc45
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -35,6 +35,8 @@ def main() -> None:
current_home = os.path.expanduser('~') + os.sep
paths = os.environ.get('PATH', '/usr/local/sbin:/usr/local/bin:/usr/bin').split(os.pathsep)
path = os.pathsep.join(x for x in paths if not x.startswith(current_home))
launcher_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kitty', 'launcher')
path = f'{launcher_dir}{os.pathsep}{path}'
with TemporaryDirectory() as tdir, env_vars(
PYTHONWARNINGS='error', HOME=tdir, USERPROFILE=tdir, PATH=path,
XDG_CONFIG_HOME=os.path.join(tdir, '.config'),