Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/bin/sage-runtests
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down