diff options
author | Alan McIntyre <alan.mcintyre@local> | 2008-12-31 23:46:34 +0000 |
---|---|---|
committer | Alan McIntyre <alan.mcintyre@local> | 2008-12-31 23:46:34 +0000 |
commit | 99d8b6a45bae8cd40a230a76c022aad277337c09 (patch) | |
tree | 543171343c14766c4ecbb7d30f5b68919cde5f8c /numpy/testing/noseclasses.py | |
parent | 8c448a31743b9ea5bc18e06dfa42c078206ca529 (diff) | |
download | numpy-99d8b6a45bae8cd40a230a76c022aad277337c09.tar.gz |
Remove the following deprecated items from numpy.testing:
- ParametricTestCase
- The following arguments from numpy.testing.Tester.test(): level,
verbosity,
all, sys_argv, testcase_pattern
- Path manipulation functions: set_package_path, set_local_path,
restore_path
- NumpyTestCase, NumpyTest
Also separated testing parameter setup from NoseTester.test into
NoseTester.prepare_test_args for use in a utility script for valgrind
testing (see NumPy ticket #784).
Diffstat (limited to 'numpy/testing/noseclasses.py')
-rw-r--r-- | numpy/testing/noseclasses.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py index ef2f90745..05d244083 100644 --- a/numpy/testing/noseclasses.py +++ b/numpy/testing/noseclasses.py @@ -1,4 +1,6 @@ -# These classes implement a doctest runner plugin for nose. +# These classes implement a doctest runner plugin for nose, a "known failure" +# error class, and a customized TestProgram for NumPy. + # Because this module imports nose directly, it should not # be used except by nosetester.py to avoid a general NumPy # dependency on nose. @@ -6,6 +8,7 @@ import os import doctest +import nose from nose.plugins import doctests as npd from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin from nose.plugins.base import Plugin @@ -275,3 +278,25 @@ class KnownFailure(ErrorClassPlugin): disable = getattr(options, 'noKnownFail', False) if disable: self.enabled = False + + + +# Because nose currently discards the test result object, but we need +# to return it to the user, override TestProgram.runTests to retain +# the result +class NumpyTestProgram(nose.core.TestProgram): + def runTests(self): + """Run Tests. Returns true on success, false on failure, and + sets self.success to the same value. + """ + if self.testRunner is None: + self.testRunner = nose.core.TextTestRunner(stream=self.config.stream, + verbosity=self.config.verbosity, + config=self.config) + plug_runner = self.config.plugins.prepareTestRunner(self.testRunner) + if plug_runner is not None: + self.testRunner = plug_runner + + self.result = self.testRunner.run(self.test) + self.success = self.result.wasSuccessful() + return self.success |