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: Handle 'sage -pytest' without file args
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Mar 30, 2022
1 parent 1242e1f commit 0d9225d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bin/sage
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,14 @@ 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 "$@"
# If no non-option arguments are given, provide one
for a in $*; do
case $a in
-*) ;;
*) exec pytest --rootdir="$SAGE_SRC" --import-mode importlib "$@"
esac
done
exec pytest --rootdir="$SAGE_SRC" --import-mode importlib "$@" "$SAGE_SRC"
else
echo "Run 'sage -i pytest' to install"
fi
Expand Down

0 comments on commit 0d9225d

Please sign in to comment.