From 0d9225d87c57f7bda7247836194ec962de476e7b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 27 Mar 2022 11:20:06 -0700 Subject: [PATCH] src/bin/sage: Handle 'sage -pytest' without file args --- src/bin/sage | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bin/sage b/src/bin/sage index 69a157b7d1f..cd91656e1ea 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -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