MichaelAquilina/zsh-autoswitch-virtualenv

Empty $LANG causes test errors

wouterweerkamp opened this issue · 1 comments

Issue Details

Tests that depend on the comparison of "Switching virtualenv: foobar [🐍Python 3.7.4]" fail when $LANG is not set (or when not supporting UTF-8).

Reason: in autoswitch_virtualenv.plugin.zsh we check for $LANG, and if it does not support UTF-* (or is not set), we remove the 🐍 from the DEFAULT_MESSAGE_FORMAT. In some of the tests however, we do not take this into consideration and simply assume 🐍 is always there, causing tests to fail.

Specifically, these tests fail:

  • plugin - switches env when .venv found
  • plugin - runs default env on load
  • _maybeworkon - switches virtualenv if current virtualenv is different
  • _maybeworkon - switches virtualenv if nothing is activated
  • check_venv - works as intended with .venv available
  • check_venv - activate if .venv unavailable but pipenv available
  • check_venv - go to default if .venv unavailable
  • check_venv - No security warning for readable only by owner permission
  • check_venv - No security warning for readable by group permission
  • check_venv - No security warning for readable by everyone permission

Solution: Remove 🐍 from the default message to avoid confusion. It is useless anyway.

Operating System (uname -a)

MacOS Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64

zsh version (zsh --version)

zsh 5.6.2 (x86_64-apple-darwin18.0.0)

autoswitch-virtualenv version (echo "$AUTOSWITCH_VERSION")

1.15.0

How is zsh-you-should-use installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Steps to reproduce the issue

  • Set LANG to empty
  • echo "$LANG" to check if empty
  • zunit in main folder of autoswitch
  • 10 tests fail

Thanks for the issue report @wouterweerkamp. We can probably fix the $LANG variable correctly in the setup functions to solve this issue.

Would you like to give it a go?