Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from pdfs import * | ||
|
||
from numpy import errstate | ||
from numpy.testing import Tester | ||
class NoseWrapper(Tester): | ||
''' | ||
This is simply a monkey patch for numpy.testing.Tester. | ||
It allows extra_argv to be changed from its default None to ['--exe'] so | ||
that the tests can be run the same across platforms. It also takes kwargs | ||
that are passed to numpy.errstate to suppress floating point warnings. | ||
''' | ||
def test(self, label='fast', verbose=1, extra_argv=['--exe'], doctests=False, | ||
coverage=False, **kwargs): | ||
''' Run tests for module using nose | ||
%(test_header)s | ||
doctests : boolean | ||
If True, run doctests in module, default False | ||
coverage : boolean | ||
If True, report coverage of NumPy code, default False | ||
(Requires the coverage module: | ||
http://nedbatchelder.com/code/modules/coverage.html) | ||
kwargs | ||
Passed to numpy.errstate. See its documentation for details. | ||
''' | ||
|
||
# cap verbosity at 3 because nose becomes *very* verbose beyond that | ||
verbose = min(verbose, 3) | ||
|
||
from numpy.testing import utils | ||
utils.verbose = verbose | ||
|
||
if doctests: | ||
print "Running unit tests and doctests for %s" % self.package_name | ||
else: | ||
print "Running unit tests for %s" % self.package_name | ||
|
||
self._show_system_info() | ||
|
||
# reset doctest state on every run | ||
import doctest | ||
doctest.master = None | ||
|
||
argv, plugins = self.prepare_test_args(label, verbose, extra_argv, | ||
doctests, coverage) | ||
from numpy.testing.noseclasses import NumpyTestProgram | ||
from warnings import simplefilter #, catch_warnings | ||
with errstate(**kwargs): | ||
## with catch_warnings(): | ||
simplefilter('ignore', category=DeprecationWarning) | ||
t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins) | ||
return t.result | ||
test = NoseWrapper().test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters