Permalink
Browse files

Merge pull request #253 from charris/fix-filter-importwarnings

Fix filter importwarnings

This PR fixes the issue left over from merging PR-251.
  • Loading branch information...
2 parents 4872cac + b86dc69 commit dafb2dd0ea89821fe9c90c42e218869cc2025e9f @rgommers rgommers committed Apr 15, 2012
Showing with 15 additions and 15 deletions.
  1. +15 −15 numpy/testing/nosetester.py
@@ -353,23 +353,23 @@ def test(self, label='fast', verbose=1, extra_argv=None,
# Preserve the state of the warning filters
warn_ctx = numpy.testing.utils.WarningManager()
warn_ctx.__enter__()
+ # Reset the warning filters to the default state,
+ # so that running the tests is more repeatable.
+ warnings.resetwarnings()
+ # If deprecation warnings are not set to 'error' below,
+ # at least set them to 'warn'.
+ warnings.filterwarnings('always', category=DeprecationWarning)
+ # Force the requested warnings to raise
+ for warningtype in raise_warnings:
+ warnings.filterwarnings('error', category=warningtype)
+ # Filter out annoying import messages.
+ warnings.filterwarnings('ignore', message='Not importing directory')
+
try:
- # Reset the warning filters to the default state,
- # so that running the tests is more repeatable.
- warnings.resetwarnings()
- # If deprecation warnings are not set to 'error' below,
- # at least set them to 'warn'.
- warnings.filterwarnings('always', category=DeprecationWarning)
- warnings.filterwarnings('ignore',
- message='Not importing directory',
- category=ImportWarning)
- # Force the requested warnings to raise
- for warningtype in raise_warnings:
- warnings.filterwarnings('error', category=warningtype)
-
- argv, plugins = self.prepare_test_args(label, verbose, extra_argv,
- doctests, coverage)
from noseclasses import NumpyTestProgram
+
+ argv, plugins = self.prepare_test_args(label,
+ verbose, extra_argv, doctests, coverage)
t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins)
finally:
warn_ctx.__exit__()

0 comments on commit dafb2dd

Please sign in to comment.