Skip to content

Commit 8eea540

Browse files
committed
add tests for GREP_OPTIONS problem (ref #51)
1 parent 9d39ffc commit 8eea540

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docs/en/history.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Release History
55
Dev
66

77
- Escape ``which`` calls to avoid aliases. Resolves :bbissue:`46`.
8+
- Integrate Manuel Kaufmann's patch to unset GREP_OPTIONS before
9+
calling grep. Resolves :bbissue:`51`.
810

911
2.2
1012

tests/test.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ test_virtualenvwrapper_verify_workon_home_missing_dir() {
4949
WORKON_HOME="$old_home"
5050
}
5151

52+
test_virtualenvwrapper_verify_workon_home_missing_dir_grep_options() {
53+
old_home="$WORKON_HOME"
54+
WORKON_HOME="$WORKON_HOME/not_there"
55+
# This should prevent the message from being found if it isn't
56+
# unset correctly.
57+
export GREP_OPTIONS="--count"
58+
assertFalse "WORKON_HOME verified unexpectedly" virtualenvwrapper_verify_workon_home
59+
WORKON_HOME="$old_home"
60+
unset GREP_OPTIONS
61+
}
62+
5263
test_virtualenvwrapper_verify_workon_home_missing_dir_quiet_init() {
5364
old_home="$WORKON_HOME"
5465
export WORKON_HOME="$WORKON_HOME/not_there"

tests/test_workon.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ test_virtualenvwrapper_show_workon_options () {
7474
rm -f "$WORKON_HOME/link_env"
7575
}
7676

77+
test_virtualenvwrapper_show_workon_options_grep_options () {
78+
mkdir "$WORKON_HOME/not_env"
79+
(cd "$WORKON_HOME"; ln -s env1 link_env)
80+
export GREP_OPTIONS="--count"
81+
envs=$(virtualenvwrapper_show_workon_options | tr '\n' ' ')
82+
unset GREP_OPTIONS
83+
assertSame "env1 env2 link_env " "$envs"
84+
rmdir "$WORKON_HOME/not_env"
85+
rm -f "$WORKON_HOME/link_env"
86+
}
87+
7788
test_virtualenvwrapper_show_workon_options_no_envs () {
7889
old_home="$WORKON_HOME"
7990
export WORKON_HOME=${TMPDIR:-/tmp}/$$

0 commit comments

Comments
 (0)