forked from sympy/sympy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test
executable file
·73 lines (63 loc) · 3.02 KB
/
test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/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 randomized 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)