Skip to content

Commit

Permalink
Revert "No longer import test and doctest with "from sympy import *""
Browse files Browse the repository at this point in the history
This reverts commit 5c3bea3.

See issue 1379.  It was decided that it was better to have these
imported, to make it easier to run the tests in interactive mode.

Conflicts:

	sympy/utilities/__init__.py
  • Loading branch information
asmeurer committed Jun 14, 2011
1 parent 1cc39b6 commit d00d02b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
7 changes: 3 additions & 4 deletions bin/coverage_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ def make_report(source_dir, report_dir, use_cache=False):
else:
cov.erase()
cov.start()
from sympy.utilities.runtests import test
test(source_dir)
#from sympy.utilities.runtests import doctest
#doctest() #coverage doesn't play well with doctests
import sympy
sympy.test(source_dir)
#sympy.doctest() #coverage doesn't play well with doctests
cov.stop()
cov.save()

Expand Down
4 changes: 2 additions & 2 deletions bin/doctest
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ from optparse import OptionParser

from get_sympy import path_hack
path_hack()
from sympy.utilities.runtests import doctest
import sympy

parser = OptionParser()
parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
Expand All @@ -34,7 +34,7 @@ parser.epilog = '"options" are any of the options above. "files" are 0 or more

options, args = parser.parse_args()

ok = doctest(*args, **{"verbose": options.verbose,
ok = sympy.doctest(*args, **{"verbose": options.verbose,
"blacklist": blacklist, "normal": options.normal})
if ok:
sys.exit(0)
Expand Down
9 changes: 4 additions & 5 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"""
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 the docstring of test in
sympy/utilities/runtests.py for documentation.
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
Expand All @@ -14,7 +13,7 @@ from optparse import OptionParser

from get_sympy import path_hack
path_hack()
from sympy.utilities.runtests import test
import sympy

parser = OptionParser()
parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
Expand All @@ -35,7 +34,7 @@ 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()

ok = test(*args, **{"verbose": options.verbose, "kw": options.kw,
ok = sympy.test(*args, **{"verbose": options.verbose, "kw": options.kw,
"tb": options.tb, "pdb": options.pdb, "colors": options.colors,
"sort": options.sort})
if ok:
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import sys

import sympy
from sympy.utilities.runtests import test, doctest

# Make sure I have the right Python version.
if sys.version_info[:2] < (2,4):
Expand Down Expand Up @@ -159,10 +158,10 @@ def finalize_options(self): # this too
pass

def run(self):
if test():
if sympy.test():
# all regular tests run successfuly, so let's also run doctests
# (if some regular test fails, the doctests are not run)
doctest()
sympy.doctest()


class run_benchmarks(Command):
Expand Down
2 changes: 2 additions & 0 deletions sympy/utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from decorator import threaded, xthreaded

from runtests import test, doctest

from cythonutils import cythonized
from timeutils import timed

Expand Down
24 changes: 12 additions & 12 deletions sympy/utilities/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,20 @@ def test(*paths, **kwargs):
Examples:
>> from sympy.utilities.runtests import test
>> import sympy
Run all tests:
>> test()
>> sympy.test()
Run one file:
>> test("sympy/core/tests/test_basic.py")
>> test("_basic")
>> sympy.test("sympy/core/tests/test_basic.py")
>> sympy.test("_basic")
Run all tests in sympy/functions/ and some particular file:
>> test("sympy/core/tests/test_basic.py", "sympy/functions")
>> sympy.test("sympy/core/tests/test_basic.py", "sympy/functions")
Run all tests in sympy/core and sympy/utilities:
>> test("/core", "/util")
>> sympy.test("/core", "/util")
"""
verbose = kwargs.get("verbose", False)
tb = kwargs.get("tb", "short")
Expand Down Expand Up @@ -174,21 +174,21 @@ def doctest(*paths, **kwargs):
Examples:
>> froms sympy.utilities.runtests import doctest
>> import sympy
Run all tests:
>> doctest()
>> sympy.doctest()
Run one file:
>> doctest("sympy/core/basic.py")
>> doctest("polynomial.txt")
>> sympy.doctest("sympy/core/basic.py")
>> sympy.doctest("polynomial.txt")
Run all tests in sympy/functions/ and some particular file:
>> doctest("/functions", "basic.py")
>> sympy.doctest("/functions", "basic.py")
Run any file having polynomial in its name, doc/src/modules/polynomial.txt,
sympy\functions\special\polynomials.py, and sympy\polys\polynomial.py:
>> doctest("polynomial")
>> sympy.doctest("polynomial")
"""
normal = kwargs.get("normal", False)
verbose = kwargs.get("verbose", False)
Expand Down

0 comments on commit d00d02b

Please sign in to comment.