diff options
-rw-r--r-- | README.txt | 7 | ||||
-rw-r--r-- | numpy/testing/nosetester.py | 21 |
2 files changed, 19 insertions, 9 deletions
diff --git a/README.txt b/README.txt index 7ec97e100..b331ec019 100644 --- a/README.txt +++ b/README.txt @@ -16,11 +16,8 @@ After installation, tests can be run with: python -c 'import numpy; numpy.test()' -When installing a new version of numpy for the first time or before upgrading -to a newer version, it is recommended to turn on deprecation warnings when -running the tests: - -python -Wd -c 'import numpy; numpy.test()' +Starting in NumPy 1.7, deprecation warnings have been set to 'raise' by +default, so the -Wd command-line option is no longer necessary. The most current development version is always available from our git repository: diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py index d6df51b0c..66b564d4b 100644 --- a/numpy/testing/nosetester.py +++ b/numpy/testing/nosetester.py @@ -6,6 +6,8 @@ This module implements ``test()`` and ``bench()`` functions for NumPy modules. """ import os import sys +import warnings +import numpy.testing.utils def get_package_name(filepath): """ @@ -323,10 +325,21 @@ class NoseTester(object): import doctest doctest.master = None - argv, plugins = self.prepare_test_args(label, verbose, extra_argv, - doctests, coverage) - from noseclasses import NumpyTestProgram - t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins) + # Preserve the state of the warning filters + warn_ctx = numpy.testing.utils.WarningManager() + warn_ctx.__enter__() + try: + + # Force deprecation warnings to raise + warnings.filterwarnings('error', category=DeprecationWarning) + + argv, plugins = self.prepare_test_args(label, verbose, extra_argv, + doctests, coverage) + from noseclasses import NumpyTestProgram + t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins) + finally: + warn_ctx.__exit__() + return t.result def bench(self, label='fast', verbose=1, extra_argv=None): |