ktongue's picture
download
raw
2.28 kB
#!/usr/bin/env python
"""
Program to execute doctests using the py.test like interface.
The advantage over py.test is that it only depends on sympy and should just
work in any circumstances. See "sympy.dotest?" for documentation.
"""
# files listed here can be in unix forward slash format with paths
# listed relative to sympy (which contains bin, etc...)
blacklist = []
import sys
import os
from optparse import OptionParser
from get_sympy import path_hack
path_hack()
parser = OptionParser()
parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
default=False)
# if you don't see a -n `default=False`;
# if you do see a -n `store_true` means to store a True value for it;
# dest is where in options to put it, options.normal will hold the bool;
# when the user enters -h or --help, print the `help` text
parser.add_option("-n", "--normal", action="store_true", dest="normal",
help="run normal doctests; do not require explicit imports", default=False)
parser.add_option('-t', '--types', dest='types', action='store',
default=None, choices=['gmpy', 'python', 'sympy'],
help='setup ground types: gmpy | python | sympy')
parser.add_option('-C', '--no-cache', dest='cache', action='store_false',
default=True, help='disable caching mechanism')
parser.add_option("--no-subprocess", action="store_false", dest="subprocess",
default=True, help="Don't run the tests in a separate "
"subprocess. This may prevent hash randomization from being enabled.")
parser.set_usage("test [options ...] [files ...]")
parser.epilog = """\
"options" are any of the options above. "files" are 0 or more glob strings of \
files to run doctests on. If no file arguments are given, all doctests will be \
run. This program runs both doctests in the source and doctests in the Sphinx \
documentation (doc/src/ directory).\
"""
options, args = parser.parse_args()
if not options.cache:
os.environ['SYMPY_USE_CACHE'] = 'no'
if options.types:
os.environ['SYMPY_GROUND_TYPES'] = options.types
import runtests
ok = runtests.doctest(*args, **{"verbose": options.verbose,
"blacklist": blacklist, "normal": options.normal, "subprocess": False})
if ok:
sys.exit(0)
else:
sys.exit(1)

Xet Storage Details

Size:
2.28 kB
·
Xet hash:
528eadeb1fc82510a2688ef283d1d47ae3d2122eb037298d9706861668ef800f

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.