Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 74 lines (63 sloc) 3.094 kb
#!/usr/bin/env python
"""
Program to execute tests 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.test?" for documentation.
"""
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)
parser.add_option("--pdb", action="store_true", dest="pdb",
default=False, help="Run post mortem pdb on each failure")
parser.add_option("--no-colors", action="store_false", dest="colors",
default=True, help="Do not report colored [OK] and [FAIL]")
parser.add_option("--force-colors", action="store_true", dest="force_colors",
default=False, help="Always use colors, even if the output is not to a terminal.")
parser.add_option("-k", dest="kw",
help="only run tests matching the given keyword expression",
metavar="KEYWORD", default="")
parser.add_option("--tb", dest="tb",
help="traceback verboseness (short/no) [default: %default]",
metavar="TBSTYLE", default="short")
parser.add_option("--random", action="store_false", dest="sort", default=True,
help="Run tests in random order instead of sorting them")
parser.add_option("--seed", dest="seed", type="int",
help="use this seed for randomised tests",
metavar="SEED")
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("--timeout", action="store", dest="timeout",
default=False, help="Set a timeout for the all functions, in seconds. By default there is no timeout.",type='int')
parser.add_option("--slow", action="store_true", dest="slow",
default=False, help="Run only the slow functions.")
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 ...] [tests ...]")
parser.epilog = """\
"options" are any of the options above. "tests" are 0 or more glob strings of \
tests to run. If no test arguments are given, all tests will be run.\
"""
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 sympy
ok = sympy.test(*args, **{"verbose": options.verbose, "kw": options.kw,
"tb": options.tb, "pdb": options.pdb, "colors": options.colors,
"force_colors": options.force_colors, "sort": options.sort, "seed":
options.seed, "slow": options.slow, "timeout": options.timeout,
'subprocess': options.subprocess})
if ok:
sys.exit(0)
else:
sys.exit(1)
Jump to Line
Something went wrong with that request. Please try again.