#! /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
from optparse import OptionParser

from get_sympy import path_hack
path_hack()
import sympy

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)

options, args = parser.parse_args()

ok = sympy.doctest(*args, **{"verbose": options.verbose,
    "blacklist": blacklist, "normal": options.normal})
if ok:
    sys.exit(0)
else:
    sys.exit(1)
