From 4763214a42c979b36adda901811a4b8688f180a5 2015-05-27 18:24:07 From: Matthias Bussonnier Date: 2015-05-27 18:24:07 Subject: [PATCH] Test imported code does not raise deprecation warning. --- diff --git a/IPython/core/tests/test_interactiveshell.py b/IPython/core/tests/test_interactiveshell.py index f6a9b71..2f43329 100644 --- a/IPython/core/tests/test_interactiveshell.py +++ b/IPython/core/tests/test_interactiveshell.py @@ -918,3 +918,27 @@ def wrn(): finally: ip.run_cell("del warnings") ip.run_cell("del wrn") + + +class TestImportNoDeprecate(tt.TempFileMixin): + + def setup(self): + """Make a valid python temp file.""" + self.mktmp(""" +import warnings +def wrn(): + warnings.warn( + "I AM A WARNING", + DeprecationWarning + ) +""") + + def test_no_dep(self): + """ + No deprecation warning should be raised from imported functions + """ + ip.run_cell("from {} import wrn".format(self.fname)) + + with tt.AssertNotPrints("I AM A WARNING"): + ip.run_cell("wrn()") + ip.run_cell("del wrn")