Skip to content

TST: Catch possible warnings - #2745

Merged
certik merged 1 commit into
numpy:masterfrom
certik:fix_warnings
Dec 4, 2012
Merged

certik merged 1 commit into
numpy:masterfrom
certik:fix_warnings

Conversation

@certik

@certik certik commented Nov 14, 2012

Copy link
Copy Markdown
Contributor

See the commit log for more details. Now all tests should always pass on Travis-CI.

@certik

certik commented Nov 14, 2012

Copy link
Copy Markdown
Contributor Author

Ok, I can see already that the "with" statement can't be used since it doesn't work in Python 2.5....

@rgommers

Copy link
Copy Markdown
Member

Like I said on the list but more explicit:

from numpy.testing import WarningManager
warn_ctx = WarningManager()
warn_ctx.__enter__()
try:
    warnings.simplefilter('ignore')
    ...
finally:
    warn_ctx.__exit__()

Previously the test sometimes fails with the following error:

======================================================================
ERROR: Test a special case for var
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.2/lib/python3.2/site-packages/numpy/ma/tests/test_core.py", line 2731, in test_varstd_specialcases
    _ = method(out=mout)
  File "/home/travis/virtualenv/python3.2/lib/python3.2/site-packages/numpy/ma/core.py", line 4778, in std
    np.power(out, 0.5, out=out, casting='unsafe')
RuntimeWarning: invalid value encountered in power

----------------------------------------------------------------------

Now we catch it, as recommended by the thread:

http://old.nabble.com/Should-abs(-nan-)-be-supported--td34389839.html
@certik

certik commented Nov 15, 2012

Copy link
Copy Markdown
Contributor Author

Thanks Ralf. I implemented this manual method and rebased. Let's see if tests pass this time.

@certik

certik commented Dec 4, 2012

Copy link
Copy Markdown
Contributor Author

I forgot to merge this. All tests pass and the PR was reviewed.

certik added a commit that referenced this pull request Dec 4, 2012
TST: Catch possible warnings
@certik
certik merged commit 7b75899 into numpy:master Dec 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants