d7c82a64a0cc7cf96069c59ae2ccf995dea0021f

Author
Wouter Weerkamp - Zeta Alpha Vector <weerkamp@zeta-alpha.com>
Committer
Wouter Weerkamp - Zeta Alpha Vector <weerkamp@zeta-alpha.com>
Date

Message

test: Removed swan-icon from DEFAULT_MESSAGE_FORMAT and from tests to allow for  that is empty or does not support UTF-8. Also disambiguated 'install_requirements - installs setup.py' test name for FULL installation.

Diff

  1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
  2index d91669ac9eb57b64ad974eea2a29b1bf18fb3136..5761ccdd381249ef8fcb0099f28abd7c9264bf19 100644
  3--- a/autoswitch_virtualenv.plugin.zsh
  4+++ b/autoswitch_virtualenv.plugin.zsh
  5@@ -64,11 +64,7 @@ function _maybeworkon() {
  6     local venv_type="$2"
  7     local venv_name="$(_get_venv_name $venv_dir $venv_type)"
  8 
  9-    local DEFAULT_MESSAGE_FORMAT="Switching %venv_type: ${BOLD}${PURPLE}%venv_name${NORMAL} ${GREEN}[๐Ÿ%py_version]${NORMAL}"
 10-    if [[ "$LANG" != *".UTF-8" ]]; then
 11-        # Remove multibyte characters if the terminal does not support utf-8
 12-        DEFAULT_MESSAGE_FORMAT="${DEFAULT_MESSAGE_FORMAT/๐Ÿ/}"
 13-    fi
 14+    local DEFAULT_MESSAGE_FORMAT="Switching %venv_type: ${BOLD}${PURPLE}%venv_name${NORMAL} ${GREEN}[%py_version]${NORMAL}"
 15 
 16     if [[ -z "$VIRTUAL_ENV" || "$venv_name" != "$(basename $VIRTUAL_ENV)" ]]; then
 17 
 18diff --git a/tests/test_check_venv.zunit b/tests/test_check_venv.zunit
 19index 7cf209224ba7d661abdd3c329f5807453db8788e..0549a693356e576dfb0ae618593f1b604ef28196 100644
 20--- a/tests/test_check_venv.zunit
 21+++ b/tests/test_check_venv.zunit
 22@@ -111,7 +111,7 @@
 23     run check_venv
 24 
 25     assert $status equals 0
 26-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
 27+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
 28 }
 29 
 30 @test 'check_venv - No security warning for readable by group permission' {
 31@@ -125,7 +125,7 @@
 32     run check_venv
 33 
 34     assert $status equals 0
 35-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
 36+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
 37 }
 38 
 39 @test 'check_venv - No security warning for readable only by owner permission' {
 40@@ -138,7 +138,7 @@
 41     run check_venv
 42 
 43     assert $status equals 0
 44-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
 45+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
 46 }
 47 
 48 
 49@@ -149,7 +149,7 @@
 50     run check_venv
 51 
 52     assert $status equals 0
 53-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoodefault\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
 54+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoodefault\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
 55 }
 56 
 57 
 58@@ -165,7 +165,7 @@
 59     run check_venv
 60 
 61     assert $status equals 0
 62-    assert "$output" same_as "Switching pipenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
 63+    assert "$output" same_as "Switching pipenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
 64 }
 65 
 66 
 67@@ -206,5 +206,5 @@
 68     run check_venv
 69 
 70     assert $status equals 0
 71-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
 72+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
 73 }
 74diff --git a/tests/test_install_requirements.zunit b/tests/test_install_requirements.zunit
 75index 33be19c130a54d6b49af538f1a085c23704f4d6a..1af1a0af4109ffd0436185c3ca22b0be569f16ad 100644
 76--- a/tests/test_install_requirements.zunit
 77+++ b/tests/test_install_requirements.zunit
 78@@ -126,7 +126,7 @@
 79     assert "$lines[6]" same_as "pytest"
 80 }
 81 
 82-@test 'install_requirements - installs setup.py' {
 83+@test 'install_requirements - installs setup.py (FULL)' {
 84     touch "setup.py"
 85     echo "django" > requirements.txt
 86 
 87diff --git a/tests/test_maybeworkon.zunit b/tests/test_maybeworkon.zunit
 88index 82df610c938436f364ae216d8aa24626e9ab4106..ae6e22e99526c547e5537d02aeca63398fb0b22a 100644
 89--- a/tests/test_maybeworkon.zunit
 90+++ b/tests/test_maybeworkon.zunit
 91@@ -38,7 +38,7 @@
 92     run _maybeworkon "$TEST_VIRTUALENV" virtualenv
 93 
 94     assert $state equals 0
 95-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
 96+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
 97 }
 98 
 99 @test '_maybeworkon - custom message' {
100@@ -67,7 +67,7 @@
101     run _maybeworkon "$TEST_VIRTUALENV" virtualfoo
102 
103     assert $state equals 0
104-    assert "$output" contains "Switching virtualfoo: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
105+    assert "$output" contains "Switching virtualfoo: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
106 }
107 
108 @test '_maybeworkon - switches virtualenv if current virtualenv is different (silent)' {
109@@ -93,5 +93,5 @@
110     run _maybeworkon hello-world-foo-de31f pipenv
111 
112     assert $state equals 0
113-    assert "$output" same_as "Switching pipenv: \e[1m\e[35mhello-world-foo\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
114+    assert "$output" same_as "Switching pipenv: \e[1m\e[35mhello-world-foo\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
115 }
116diff --git a/tests/test_plugin.zunit b/tests/test_plugin.zunit
117index 2ed87a420545e112b3bbc8598c4e9d94456b27cb..e0daa76b8c3ac4827211ca25e21f53e2e48f4e49 100644
118--- a/tests/test_plugin.zunit
119+++ b/tests/test_plugin.zunit
120@@ -36,7 +36,7 @@
121     run load ../autoswitch_virtualenv.plugin.zsh
122 
123     assert $status equals 0
124-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
125+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
126 }
127 
128 @test 'plugin - does nothing if switching to directory without .venv' {
129@@ -62,7 +62,7 @@
130     run cd "$TEMP_DIR"
131 
132     assert $status equals 0
133-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
134+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
135 
136     mkdir "$TEMP_DIR/foo"
137 
138@@ -70,5 +70,5 @@
139     run cd "$TEMP_DIR/foo"
140 
141     assert $status equals 0
142-    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[๐Ÿ$PYTHON_VERSION]\e[0m"
143+    assert "$output" same_as "Switching virtualenv: \e[1m\e[35mfoobar\e[0m \e[32m[$PYTHON_VERSION]\e[0m"
144 }