Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/bin/sage: Implement 'sage --pytest'
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Mar 26, 2022
1 parent 55a711e commit 9385501
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/bin/sage
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ usage_advanced() {
echo " --help -- show tox help"
command -v tox &>/dev/null || \
echo " (not installed currently, run sage -i tox)"
echo " --pytest [options] <files|dirs> -- run pytest on the Sage library"
command -v pytest &>/dev/null || \
echo " (not installed currently, run sage -i pytest)"
echo " --help -- show pytest help"
fi
echo
echo "Some developer utilities:"
Expand Down Expand Up @@ -940,10 +944,24 @@ if [ "$1" = '-tox' -o "$1" = '--tox' ]; then
if command -v tox >/dev/null ; then
exec tox -c "$SAGE_SRC" "$@"
else
echo "Run sage -i tox to install"
echo "Run 'sage -i tox' to install"
fi
else
echo >&2 "error: Sage source directory or tox.ini not avialable"
echo >&2 "error: Sage source directory or tox.ini not available"
exit 1
fi
fi

if [ "$1" = '-pytest' -o "$1" = '--pytest' ]; then
shift
if [ -n "$SAGE_SRC" -a -f "$SAGE_SRC/tox.ini" ]; then
if command -v pytest >/dev/null ; then
exec pytest --rootdir="$SAGE_SRC" --import-mode importlib "$@"
else
echo "Run 'sage -i pytest' to install"
fi
else
echo >&2 "error: Sage source directory or tox.ini not available"
exit 1
fi
fi
Expand Down

0 comments on commit 9385501

Please sign in to comment.