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

Commit

Permalink
trac #18558: now with an 'installed_optional' keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanncohen committed May 31, 2015
1 parent dd586b9 commit e45591a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/bin/sage-runtests
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ if __name__ == "__main__":
parser.add_option("--warn-long", dest="warn_long", default=None, action="callback",
callback=optional_argument, callback_args=(float, 1.0), nargs=0,
metavar="SECONDS", help="warn if tests take more time than SECONDS")
parser.add_option("--optional", metavar="PKGS", default="sage_and_installed_packages",
parser.add_option("--optional", metavar="PKGS", default="sage,installed_optional",
help='only run tests including one of the "# optional" tags listed in PKGS; '
'if "sage" is listed will also test the standard doctests; '
'if set to "all", then all tests will be run; '
'if unspecified, "sage" and all installed optional packages will be tested.')
'if "installed_optional" is listed will also test all (installed) optional packages; '
'if set to "all", then all tests will be run; ')
parser.add_option("--randorder", type=int, metavar="SEED", help="randomize order of tests")
parser.add_option("--global-iterations", "--global_iterations", type=int, default=0, help="repeat the whole testing process this many times")
parser.add_option("--file-iterations", "--file_iterations", type=int, default=0, help="repeat each file this many times, stopping on the first failure")
Expand Down Expand Up @@ -80,14 +80,6 @@ if __name__ == "__main__":
from sage.doctest.control import DocTestController
options, args = parser.parse_args()

# If no list of optional packages is given, we test 'sage' and all
# (installed) optional packages.
if options.optional == "sage_and_installed_packages":
from sage.misc.package import _package_lists_from_sage_output
from string import join
additional_packages = _package_lists_from_sage_output('optional',local=True)[0]
options.optional = join(["sage"]+additional_packages,",")

if len(args) == 0 and not (options.all or options.sagenb or options.new):
parser.print_help()
err = 2
Expand Down
8 changes: 8 additions & 0 deletions src/sage/doctest/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ def __init__(self, options, args):
options.optional = True
else:
options.optional = set(s.split(','))

# we replace the 'optional' tag by all (installed) optional packages
if 'installed_optional' in options.optional:
from sage.misc.package import _package_lists_from_sage_output
from string import join
options.optional.discard('installed_optional')
options.optional.update(_package_lists_from_sage_output('optional',local=True)[0])

# Check that all tags are valid
for o in options.optional:
if not optionaltag_regex.search(o):
Expand Down

0 comments on commit e45591a

Please sign in to comment.