summaryrefslogtreecommitdiff
path: root/numpy/distutils/tests
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-03-28 10:48:45 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-03-28 10:48:45 -0600
commit15b7f9b6519d3b5c3d4ddc2a23459ca089527fc0 (patch)
tree1f596cca1aa94f22a55f42b2802ff20bc55053b1 /numpy/distutils/tests
parent40742184df68fc01f3392c9865f35d5402e74b01 (diff)
downloadnumpy-15b7f9b6519d3b5c3d4ddc2a23459ca089527fc0.tar.gz
MAINT: Fix python3 ResourceWarning when running test_exec_command.py
The tests in test_exec_command.py used with blocks with a context manager that could redirect stderr and stdout to temporary files but those files were not closed on exit from the block.
Diffstat (limited to 'numpy/distutils/tests')
-rw-r--r--numpy/distutils/tests/test_exec_command.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/distutils/tests/test_exec_command.py b/numpy/distutils/tests/test_exec_command.py
index d38c096ba..9301a2097 100644
--- a/numpy/distutils/tests/test_exec_command.py
+++ b/numpy/distutils/tests/test_exec_command.py
@@ -18,6 +18,8 @@ class redirect_stdout(object):
def __exit__(self, exc_type, exc_value, traceback):
self._stdout.flush()
sys.stdout = self.old_stdout
+ # note: closing sys.stdout won't close it.
+ self._stdout.close()
class redirect_stderr(object):
"""Context manager to redirect stderr for exec_command test."""
@@ -31,6 +33,8 @@ class redirect_stderr(object):
def __exit__(self, exc_type, exc_value, traceback):
self._stderr.flush()
sys.stderr = self.old_stderr
+ # note: closing sys.stderr won't close it.
+ self._stderr.close()
class emulate_nonposix(object):
"""Context manager to emulate os.name != 'posix' """