Skip to content

Commit

Permalink
py.test: New completion
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed May 5, 2017
1 parent 0cea46f commit eae26d9
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 0 deletions.
1 change: 1 addition & 0 deletions completions/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ pvremove
pvs
pvscan
pxz
py.test-[23]
pydoc3
python2
python3
Expand Down
7 changes: 7 additions & 0 deletions completions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ bashcomp_DATA = 2to3 \
pwd \
pwdx \
pwgen \
py.test \
pydoc \
pyflakes \
pylint \
Expand Down Expand Up @@ -566,6 +567,8 @@ CLEANFILES = \
pvs \
pvscan \
pxz \
py.test-2 \
py.test-3 \
pydoc3 \
pypy \
pypy3 \
Expand Down Expand Up @@ -867,6 +870,10 @@ symlinks: $(targetdir) $(DATA)
rm -f $(targetdir)/$$file && \
$(LN_S) puppet $(targetdir)/$$file ; \
done
for file in py.test-2 py.test-3 ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) py.test $(targetdir)/$$file ; \
done
for file in pydoc3 ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) pydoc $(targetdir)/$$file ; \
Expand Down
71 changes: 71 additions & 0 deletions completions/py.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# bash completion for py.test(1) -*- shell-script -*-

_py_test()
{
local cur prev words cword split
_init_completion -s || return

case $prev in
-h|--help|-k|-m|--maxfail|-r|--report|--junit-prefix|--doctest-glob|-p)
return
;;
--import-mode)
COMPREPLY=( $( compgen -W "prepend append" -- "$cur" ) )
return
;;
--capture)
COMPREPLY=( $( compgen -W "fd sys no" -- "$cur" ) )
return
;;
--tb)
COMPREPLY=( $( compgen -W "auto long short line native no" \
-- "$cur" ) )
return
;;
--color)
COMPREPLY=( $( compgen -W "yes no auto" -- "$cur" ) )
return
;;
--pastebin)
COMPREPLY=( $( compgen -W "failed all" -- "$cur" ) )
return
;;
--junit-xml)
_filedir xml
return
;;
--result-log)
_filedir log
return
;;
--ignore)
_filedir
return
;;
--confcutdir|--basetemp)
_filedir -d
return
;;
--assert)
COMPREPLY=( $( compgen -W "plain reinterp rewrite" -- "$cur" ) )
return
;;
--genscript)
_filedir py
return
;;
esac

$split && return

if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi

_filedir py
} &&
complete -F _py_test py.test py.test-2 py.test-3

# ex: filetype=sh
1 change: 1 addition & 0 deletions test/completion/py.test.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assert_source_completions py.test
1 change: 1 addition & 0 deletions test/docker/Dockerfile-ubuntu14
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ RUN apt-get update && \
pyflakes \
pylint \
python-flake8 \
python-pytest \
python3 \
quota \
rcs \
Expand Down
21 changes: 21 additions & 0 deletions test/lib/completions/py.test.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
proc setup {} {
save_env
}


proc teardown {} {
assert_env_unmodified
}


setup


assert_complete_any "py.test "
sync_after_int

assert_complete_any "py.test -"
sync_after_int


teardown

0 comments on commit eae26d9

Please sign in to comment.