forked from sympy/sympy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test
executable file
·38 lines (31 loc) · 1.39 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
#! /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 os
import sys
from optparse import OptionParser
bintest_dir = os.path.abspath(os.path.dirname(__file__)) # bin/test
sympy_top = os.path.split(bintest_dir)[0] # ../
sympy_dir = os.path.join(sympy_top, 'sympy') # ../sympy/
if os.path.isdir(sympy_dir):
sys.path.insert(0, sympy_top)
import sympy
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("-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")
options, args = parser.parse_args()
ok = sympy.test(*args, **{"verbose": options.verbose, "kw": options.kw,
"tb": options.tb, "pdb": options.pdb, "colors": options.colors})
if ok:
sys.exit(0)
else:
sys.exit(1)