From 595698d8e95094b5fa439e24eddad4785aae7d07 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 21 Feb 2022 16:57:11 +0530 Subject: [PATCH] Remove dirs in HOME from PATH wen running tests --- test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test.py b/test.py index c093f41b2..1383415ea 100755 --- a/test.py +++ b/test.py @@ -32,8 +32,11 @@ def init_env() -> None: def main() -> None: warnings.simplefilter('error') + 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)) with TemporaryDirectory() as tdir, env_vars( - PYTHONWARNINGS='error', HOME=tdir, USERPROFILE=tdir, + PYTHONWARNINGS='error', HOME=tdir, USERPROFILE=tdir, PATH=path, XDG_CONFIG_HOME=os.path.join(tdir, '.config'), XDG_CONFIG_DIRS=os.path.join(tdir, '.config'), XDG_DATA_DIRS=os.path.join(tdir, '.local', 'xdg'),