summaryrefslogtreecommitdiff
path: root/numpy/distutils/tests/test_exec_command.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils/tests/test_exec_command.py')
-rw-r--r--numpy/distutils/tests/test_exec_command.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/distutils/tests/test_exec_command.py b/numpy/distutils/tests/test_exec_command.py
index 3bbad9386..d6eb7d1c3 100644
--- a/numpy/distutils/tests/test_exec_command.py
+++ b/numpy/distutils/tests/test_exec_command.py
@@ -186,9 +186,8 @@ class TestExecCommand:
with tempdir() as tmpdir:
fn = "file"
tmpfile = os.path.join(tmpdir, fn)
- f = open(tmpfile, 'w')
- f.write('Hello')
- f.close()
+ with open(tmpfile, 'w') as f:
+ f.write('Hello')
s, o = exec_command.exec_command(
'"%s" -c "f = open(\'%s\', \'r\'); f.close()"' %