From fd60e064ac0e54c6424f980cf87d89bb5a6bc8bc 2021-11-07 02:35:31 From: Matthias Bussonnier Date: 2021-11-07 02:35:31 Subject: [PATCH] Merge pull request #13248 from Kojoley/refactor-test_shim_warning Make test_shim_warning not fail on unrelated warnings --- diff --git a/IPython/utils/tests/test_shimmodule.py b/IPython/utils/tests/test_shimmodule.py index 3a15617..814e482 100644 --- a/IPython/utils/tests/test_shimmodule.py +++ b/IPython/utils/tests/test_shimmodule.py @@ -1,13 +1,10 @@ +import pytest import sys -import warnings from IPython.utils.shimmodule import ShimWarning def test_shim_warning(): sys.modules.pop('IPython.config', None) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") + with pytest.warns(ShimWarning): import IPython.config - assert len(w) == 1 - assert issubclass(w[-1].category, ShimWarning)