Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
trac #33531: don't run pytest by default
Browse files Browse the repository at this point in the history
Since running pytest is broken right now (see #31924, #32975, ...), we
don't run pytest by default anymore.

In order to run pytest one has to use the feature flag "pytest", for
instance:

    $ ./sage -t --optional=pytest src/sage/numerical/backends/cvxopt_backend_test.py

This will run only pytest; one can use --optional=sage,pytest to run both.
  • Loading branch information
tornaria committed Mar 19, 2022
1 parent 55a711e commit f5608aa
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/bin/sage-runtests
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,22 @@ if __name__ == "__main__":
DC = DocTestController(args, args.filenames)
err = DC.run()

try:
exit_code_pytest = 0
import pytest
pytest_options = ["--import-mode", "importlib"]
if args.verbose:
pytest_options.append("-v")
exit_code_pytest = pytest.main(pytest_options + args.filenames)
if exit_code_pytest == 5:
# Exit code 5 means there were no test files, pass in this case
if "pytest" in DC.options.optional:
try:
exit_code_pytest = 0

except ModuleNotFoundError:
print("Pytest is not installed, skip checking tests that rely on it.")

if err == 0:
sys.exit(exit_code_pytest)
else:
sys.exit(err)
import pytest
pytest_options = ["--import-mode", "importlib"]
if args.verbose:
pytest_options.append("-v")
exit_code_pytest = pytest.main(pytest_options + args.filenames)
if exit_code_pytest == 5:
# Exit code 5 means there were no test files, pass in this case
exit_code_pytest = 0

except ModuleNotFoundError:
print("Pytest is not installed, skip checking tests that rely on it.")

if err == 0:
sys.exit(exit_code_pytest)

sys.exit(err)

0 comments on commit f5608aa

Please sign in to comment.