TST: Don't assert that a bug exists in numpy (#16940)
authorEric Wieser <wieser.eric@gmail.com>
Sat, 15 Jul 2017 12:30:03 +0000 (13:30 +0100)
committerMo Zhou <cdluminate@gmail.com>
Sat, 20 Jan 2018 09:00:31 +0000 (09:00 +0000)
Better to ignore the warning from the bug, rather than assert the bug is still there

After this change, numpy/numpy#9412 _could_ be backported to fix the bug

Gbp-Pq: Name up_tst_dont_assert_that_a_bug_exists_in_numpy

pandas/tests/test_algos.py

index 3fa236c4ae8a441083ed50084511dc4b421d4fa4..cd70c2074f175a5038307ae0e3ac368be6cf31e0 100644 (file)
@@ -2,6 +2,7 @@
 
 import numpy as np
 import pytest
+import warnings
 
 from numpy.random import RandomState
 from numpy import nan
@@ -127,7 +128,7 @@ class TestSafeSort(object):
         arr = np.array([1, 2, datetime.now(), 0, 3], dtype=object)
         if compat.PY2 and not pd._np_version_under1p10:
             # RuntimeWarning: tp_compare didn't return -1 or -2 for exception
-            with tm.assert_produces_warning(RuntimeWarning):
+            with warnings.catch_warnings():
                 pytest.raises(TypeError, algos.safe_sort, arr)
         else:
             pytest.raises(TypeError, algos.safe_sort, arr)