diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests index 4d606c5a3a8..01b7ca44868 100755 --- a/src/bin/sage-runtests +++ b/src/bin/sage-runtests @@ -175,13 +175,18 @@ if __name__ == "__main__": pytest_options = [] if args.verbose: pytest_options.append("-v") - # #31924: Do not run pytest on individual Python files unless - # they match the pytest file pattern. However, pass names - # of directories. We use 'not os.path.isfile(f)' for this so that - # we do not silently hide typos. - filenames = [f for f in args.filenames - if f.endswith("_test.py") or not os.path.isfile(f)] - if filenames or not args.filenames: + + # #35999: no filename in arguments defaults to "src" + if not args.filenames: + filenames = [SAGE_SRC] + else: + # #31924: Do not run pytest on individual Python files unless + # they match the pytest file pattern. However, pass names + # of directories. We use 'not os.path.isfile(f)' for this so that + # we do not silently hide typos. + filenames = [f for f in args.filenames + if f.endswith("_test.py") or not os.path.isfile(f)] + if filenames: print(f"Running pytest on {filenames} with options {pytest_options}") exit_code_pytest = pytest.main(filenames + pytest_options) if exit_code_pytest == 5: