diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2012-04-15 14:41:27 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2012-04-15 14:41:27 -0600 |
commit | cb9d3592e3fd91bc0081904848df454bd8167b91 (patch) | |
tree | 0166b48f26f23894be87cf7c4ef15c712b0ab3e6 /numpy | |
parent | c17738ac4093377a991a7d221349f8de6e06c690 (diff) | |
download | numpy-cb9d3592e3fd91bc0081904848df454bd8167b91.tar.gz |
BUG: Fix testing failure on missing ImportWarning in Python 2.4.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/testing/nosetester.py | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py index 950cb5436..23e28a855 100644 --- a/numpy/testing/nosetester.py +++ b/numpy/testing/nosetester.py @@ -353,23 +353,27 @@ class NoseTester(object): # 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) + # ImportWarning not available in Python 2.4 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) + message='Not importing directory', category=ImportWarning) + except: + pass + + try: 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__() |