Doug Hellmann avatar Doug Hellmann committed 3fad348

add tests for GREP_OPTIONS problem (ref #51)

Comments (0)

Files changed (3)

docs/en/history.rst

 Dev
 
   - Escape ``which`` calls to avoid aliases. Resolves :bbissue:`46`.
+  - Integrate Manuel Kaufmann's patch to unset GREP_OPTIONS before
+    calling grep.  Resolves :bbissue:`51`.
 
 2.2
 
     WORKON_HOME="$old_home"
 }
 
+test_virtualenvwrapper_verify_workon_home_missing_dir_grep_options() {
+    old_home="$WORKON_HOME"
+    WORKON_HOME="$WORKON_HOME/not_there"
+    # This should prevent the message from being found if it isn't
+    # unset correctly.
+    export GREP_OPTIONS="--count"
+    assertFalse "WORKON_HOME verified unexpectedly" virtualenvwrapper_verify_workon_home
+    WORKON_HOME="$old_home"
+    unset GREP_OPTIONS
+}
+
 test_virtualenvwrapper_verify_workon_home_missing_dir_quiet_init() {
     old_home="$WORKON_HOME"
     export WORKON_HOME="$WORKON_HOME/not_there"

tests/test_workon.sh

     rm -f "$WORKON_HOME/link_env"
 }
 
+test_virtualenvwrapper_show_workon_options_grep_options () {
+    mkdir "$WORKON_HOME/not_env"
+    (cd "$WORKON_HOME"; ln -s env1 link_env)
+    export GREP_OPTIONS="--count"
+    envs=$(virtualenvwrapper_show_workon_options | tr '\n' ' ')
+    unset GREP_OPTIONS
+    assertSame "env1 env2 link_env " "$envs"
+    rmdir "$WORKON_HOME/not_env"
+    rm -f "$WORKON_HOME/link_env"
+}
+
 test_virtualenvwrapper_show_workon_options_no_envs () {
     old_home="$WORKON_HOME"
     export WORKON_HOME=${TMPDIR:-/tmp}/$$
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.