From 208d0c1c0db2b1056678898dd300eb38c7625f9e 2016-05-20 20:45:59 From: Matthias Bussonnier Date: 2016-05-20 20:45:59 Subject: [PATCH] Correctly teardown test case, avoid filehandle leaking. --- diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index d100ec2..9e1a883 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -44,6 +44,8 @@ pjoin = path.join # Enable printing all warnings raise by IPython's modules +if sys.version_info > (3,0): + warnings.filterwarnings('error', message='.*', category=ResourceWarning, module='.*') warnings.filterwarnings('default', message='.*', category=Warning, module='IPy.*') if version_info < (6,): diff --git a/IPython/testing/tests/test_tools.py b/IPython/testing/tests/test_tools.py index a4c2e77..9c6db65 100644 --- a/IPython/testing/tests/test_tools.py +++ b/IPython/testing/tests/test_tools.py @@ -132,3 +132,9 @@ class Test_ipexec_validate(unittest.TestCase, tt.TempFileMixin): ) out = "A\r\nB" tt.ipexec_validate(self.fname, expected_out=out, expected_err="C\r\nD") + + + def tearDown(self): + # tear down correctly the mixin, + # unittest.TestCase.tearDown does nothing + tt.TempFileMixin.tearDown(self)