8000 TST: filter ImportWarnings in NoseTester. by rgommers · Pull Request #251 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TST: filter ImportWarnings in NoseTester. #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
TST: filter ImportWarnings in NoseTester.
Warnings show up when a directory with the same name as a Python file or
compiled extension is seen which doesn't have an __init__.py file in it.  This
situation is very common, for example in SciPy where many extensions are
created from source files located under a directory with the same name.

This filter is located within a context manager, so only filters when running
tests.
  • Loading branch information
Ralf Gommers committed Apr 14, 2012
commit 08c20a2c23397eed0923e9ca768b4fe26c244730
3 changes: 3 additions & 0 deletions numpy/testing/nosetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ def test(self, label='fast', verbose=1, extra_argv=None,
# 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)
Expand Down
0