From 05bc58f97cb8b3a8712f7fb129b40d0446bc35de Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Mar 2022 16:51:06 -0700 Subject: [PATCH] src/tox.ini (pytest): Set --import-mode importlib here, not in src/bin/sage, src/bin/sage-runtests --- src/bin/sage | 4 ++-- src/bin/sage-runtests | 2 +- src/tox.ini | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/sage b/src/bin/sage index cd91656e1ea..e94cc50940e 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -960,10 +960,10 @@ if [ "$1" = '-pytest' -o "$1" = '--pytest' ]; then for a in $*; do case $a in -*) ;; - *) exec pytest --rootdir="$SAGE_SRC" --import-mode importlib "$@" + *) exec pytest --rootdir="$SAGE_SRC" "$@" esac done - exec pytest --rootdir="$SAGE_SRC" --import-mode importlib "$@" "$SAGE_SRC" + exec pytest --rootdir="$SAGE_SRC" "$@" "$SAGE_SRC" else echo "Run 'sage -i pytest' to install" fi diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests index 3022e446fee..14ebf4b6b96 100755 --- a/src/bin/sage-runtests +++ b/src/bin/sage-runtests @@ -151,7 +151,7 @@ if __name__ == "__main__": try: exit_code_pytest = 0 import pytest - pytest_options = ["--import-mode", "importlib"] + pytest_options = [] if args.verbose: pytest_options.append("-v") exit_code_pytest = pytest.main(pytest_options + args.filenames) diff --git a/src/tox.ini b/src/tox.ini index d68df4848bd..92f31602ba7 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -156,6 +156,7 @@ commands = codespell \ [pytest] python_files = *_test.py +addopts = --import-mode importlib [coverage:run] source = sage