From 00e9b684eb4353249b0c2134b42d19e11dfc9455 2014-12-15 18:28:51 From: Min RK Date: 2014-12-15 18:28:51 Subject: [PATCH] ensure warnings are raised in tests avoids missed warnings if the warning was already shown --- diff --git a/IPython/core/tests/test_display.py b/IPython/core/tests/test_display.py index 2fc284e..713b567 100644 --- a/IPython/core/tests/test_display.py +++ b/IPython/core/tests/test_display.py @@ -134,15 +134,20 @@ def test_json(): lis = [d] j = display.JSON(d) nt.assert_equal(j._repr_json_(), d) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") j = display.JSON(json.dumps(d)) nt.assert_equal(len(w), 1) - nt.assert_equal(j._repr_json_(), d) + nt.assert_equal(j._repr_json_(), d) + j = display.JSON(lis) nt.assert_equal(j._repr_json_(), lis) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") j = display.JSON(json.dumps(lis)) nt.assert_equal(len(w), 1) - nt.assert_equal(j._repr_json_(), lis) + nt.assert_equal(j._repr_json_(), lis)