From 8c448a31743b9ea5bc18e06dfa42c078206ca529 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 31 Dec 2008 23:25:03 +0000 Subject: ran reindent --- numpy/testing/noseclasses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/testing/noseclasses.py') diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py index d838a5f84..ef2f90745 100644 --- a/numpy/testing/noseclasses.py +++ b/numpy/testing/noseclasses.py @@ -251,7 +251,7 @@ class KnownFailureTest(Exception): class KnownFailure(ErrorClassPlugin): - '''Plugin that installs a KNOWNFAIL error class for the + '''Plugin that installs a KNOWNFAIL error class for the KnownFailureClass exception. When KnownFailureTest is raised, the exception will be logged in the knownfail attribute of the result, 'K' or 'KNOWNFAIL' (verbose) will be output, and the -- cgit v1.2.1 From 99d8b6a45bae8cd40a230a76c022aad277337c09 Mon Sep 17 00:00:00 2001 From: Alan McIntyre Date: Wed, 31 Dec 2008 23:46:34 +0000 Subject: 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). --- numpy/testing/noseclasses.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'numpy/testing/noseclasses.py') 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 -- cgit v1.2.1