biocore/scikit-bio — pull request #615 by jairideout (2014-08-11 20:42:11+00:00)
Title: Remove duplicate code in unit tests used to ignore warnings

There was duplicate code in `skbio/alignment/tests/test_pairwise.py` that ignored warnings, i.e.:

```python
with warnings.catch_warnings():
warnings.simplefilter("ignore")
...
```

I removed these lines in favor of `setUp`/`tearDown` methods that ignore warnings and reset the warnings filter, respectively. This is the current strategy used by `skbio/stats/tests/test_subsample.py` and it seems to work well.

I played around with using `npt.assert_warns` in the pairwise alignment unit tests (this was what I originally suggested we do in #479). I couldn't get the tests to pass when running the entire test suite because (I think) the warnings are issued in some of the doctests, which prevents them from being issued in the unit tests, causing `npt.assert_warns` to fail. I tried various combinations of `warnings.simplefilter`, `warnings.resetwarnings`, and `warnings.catch_warnings`, but didn't have any luck.

I also added `npt.assert_warns` calls to some other unit tests that don't have accompanying doctests (`skbio/alignment/tests/test_alignment.py` and `skbio/diversity/beta/tests/test_base.py`).

Fixes #479. @ebolyen or @gregcaporaso can you please review?