summaryrefslogtreecommitdiff
path: root/numpy/testing/numpytest.py
diff options
context:
space:
mode:
authorPearu Peterson <pearu.peterson@gmail.com>2006-02-24 08:31:00 +0000
committerPearu Peterson <pearu.peterson@gmail.com>2006-02-24 08:31:00 +0000
commita616cf68bfd7d4242557c6cd0a790ed0f013b246 (patch)
tree5ab05932e4a0cd9b0a792beceb432666a8bd9f10 /numpy/testing/numpytest.py
parentfc3ad911ae8a5ef2b3888fe82581ddf117f44f24 (diff)
downloadnumpy-a616cf68bfd7d4242557c6cd0a790ed0f013b246.tar.gz
Improved the meaning of test level argument: with negative level return a list of abs(level) unit tests, with a positive value, also run them.
Diffstat (limited to 'numpy/testing/numpytest.py')
-rw-r--r--numpy/testing/numpytest.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/numpy/testing/numpytest.py b/numpy/testing/numpytest.py
index 00d778e42..4b43c428e 100644
--- a/numpy/testing/numpytest.py
+++ b/numpy/testing/numpytest.py
@@ -385,16 +385,17 @@ class NumpyTest:
""" Run Numpy module test suite with level and verbosity.
level:
- None or <= -3 --- do nothing, return None
- -2 --- import package, return None
- -1 --- scan for tests and return TestRunner instance
- > 0 --- scan for tests, run them, return TestRunner
+ None --- do nothing, return None
+ < 0 --- scan for tests of level=abs(level),
+ don't run them, return TestSuite-list
+ > 0 --- scan for tests of level, run them,
+ return TestRunner
verbosity:
>= 0 --- show information messages
> 1 --- show warnings on missing tests
"""
- if level is None or level<=-3: # Do nothing.
+ if level is None: # Do nothing.
return
if isinstance(self.package, str):
@@ -402,9 +403,6 @@ class NumpyTest:
else:
this_package = self.package
- if level==-2: # Import package and do nothing.
- return
-
package_name = this_package.__name__
modules = []
@@ -421,15 +419,15 @@ class NumpyTest:
self.test_files = []
suites = []
for module in modules:
- suites.extend(self._get_module_tests(module, level, verbosity))
+ suites.extend(self._get_module_tests(module, abs(level), verbosity))
- suites.extend(self._get_suite_list(sys.modules[package_name], level,
- verbosity=verbosity))
+ suites.extend(self._get_suite_list(sys.modules[package_name],
+ abs(level), verbosity=verbosity))
all_tests = unittest.TestSuite(suites)
- #if hasattr(sys,'getobjects'):
- # runner = SciPyTextTestRunner(verbosity=verbosity)
- #else:
+ if level<0:
+ return all_tests
+
runner = unittest.TextTestRunner(verbosity=verbosity)
# Use the builtin displayhook. If the tests are being run
# under IPython (for instance), any doctest test suites will