forked from colonelpanic/dotfiles
Ivan Malison
6174990049
Fix web_start. Add remote_clipboard server stuff. Bump .emacs.d pointer and add remote_os_copy alias. Way better get_cols Made git sui git suir move to same sha as yelp branch for .emacs.d Bump emacs pointer. simplified default code for remote_clipboard. Remove unused functions from .functions. Added things from yelp branch. yelpify Added field separator to get_cols. Lots of refactoring. Added .lib directory. Moved dotfiles that get symlinked to ~ into their own directory. Remove some vim configuration. Remove oh-my-zsh.
74 lines
1.5 KiB
Plaintext
74 lines
1.5 KiB
Plaintext
#compdef testify
|
|
|
|
_testify() {
|
|
typeset -A opt_args
|
|
local context state line
|
|
|
|
BASE_TEST_PATH='yelp.tests'
|
|
_arguments "1:testify_file:->file" "2:testify_:->test_case"
|
|
|
|
case $state in
|
|
(file)
|
|
_find_test_files
|
|
;;
|
|
(test_case)
|
|
_find_test_methods
|
|
;;
|
|
esac
|
|
|
|
return 0
|
|
}
|
|
|
|
(( $+functions[_print_test_methods] )) ||
|
|
_print_test_methods() {
|
|
python - "$@" <<ENDPYTHON
|
|
import sys
|
|
from testify import test_discovery
|
|
|
|
if __name__ == '__main__':
|
|
for test_case in test_discovery.discover(sys.argv[1]):
|
|
print test_case.__name__
|
|
for member in dir(test_case):
|
|
if member.startswith("test"):
|
|
print "%s.%s" % (test_case.__name__, member)
|
|
ENDPYTHON
|
|
|
|
}
|
|
|
|
(( $+functions[_find_test_methods] )) ||
|
|
_find_test_methods() {
|
|
TEST_COMPLETIONS=( `_print_test_methods $line 2> /dev/null` )
|
|
for COMPLETION in $TEST_COMPLETIONS
|
|
do
|
|
compadd $COMPLETION
|
|
done
|
|
return 0
|
|
}
|
|
|
|
(( $+functions[_find_test_files] )) ||
|
|
_find_test_files() {
|
|
local SEARCH_PATH
|
|
if [[ "$PREFIX" == "$BASE_TEST_PATH"* ]]
|
|
then
|
|
SEARCH_PATH="${PREFIX%.*}"
|
|
else
|
|
compadd $BASE_TEST_PATH
|
|
compadd $BASE_TEST_PATH'.'
|
|
return 0
|
|
fi
|
|
SEARCH_PATH=$(echo "$SEARCH_PATH" | tr . /)
|
|
DIRECTORIES=( "$SEARCH_PATH"/*(/) )
|
|
PY_FILES=( "$SEARCH_PATH"/*.py )
|
|
for DIRECTORY in $DIRECTORIES
|
|
do
|
|
compadd `echo "${DIRECTORY}" | tr / .`
|
|
compadd `echo "${DIRECTORY}" | tr / .`'.'
|
|
done
|
|
|
|
for PY_FILE in $PY_FILES
|
|
do
|
|
compadd `echo "${PY_FILE%.py}" | tr / .`
|
|
done
|
|
return 0
|
|
}
|