From 042d0910be8cc1f6f9aa32bac5359057df4ce8b2 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sun, 4 Aug 2024 21:18:17 +0200 Subject: [PATCH] Ensure ZSH-related tests succeed when TERM variable is set to linux (#497) * Fix ZSH tests when TERM variable is set to linux Running the test-suite with TERM=linux causes the ZSH related tests to fail. Fixed by hardcoding TERM="" when running the ZSH tests. Signed-off-by: Olivier Gayot * Also ensure zsh does not load global RC files when running test-suite While bash only has a single option for disabling bashrc loading, ZSH comes with two options: one for $HOME/.zshrc and one for the global zshrc (typically located in /etc). Pass both options to avoid surprises. Signed-off-by: Olivier Gayot --------- Signed-off-by: Olivier Gayot --- test/test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test.py b/test/test.py index 4382faf..75da9b8 100755 --- a/test/test.py +++ b/test/test.py @@ -65,6 +65,7 @@ def run_command(self, command, **kwargs): def _repl_sh(command, args, non_printable_insert): os.environ["PS1"] = "$" + os.environ["TERM"] = "" child = pexpect.spawn(command, args, echo=False, encoding="utf-8") ps1 = PEXPECT_PROMPT[:5] + non_printable_insert + PEXPECT_PROMPT[5:] ps2 = PEXPECT_CONTINUATION_PROMPT[:5] + non_printable_insert + PEXPECT_CONTINUATION_PROMPT[5:] @@ -79,7 +80,7 @@ def bash_repl(command="bash"): def zsh_repl(command="zsh"): - sh = _repl_sh(command, ["--no-rcs", "-V"], non_printable_insert="%(!..)") + sh = _repl_sh(command, ["--no-rcs", "--no-globalrcs", "-V"], non_printable_insert="%(!..)") # Require two tabs to print all options (some tests rely on this). sh.run_command("setopt BASH_AUTO_LIST") return sh