summaryrefslogtreecommitdiff
path: root/numpy/distutils/tests/test_exec_command.py
diff options
context:
space:
mode:
authorSeth Troisi <sethtroisi@google.com>2020-01-21 11:32:58 -0800
committerSeth Troisi <sethtroisi@google.com>2020-01-21 11:34:58 -0800
commitb54108238dbd1ce2673a042b0b270f666ea96e29 (patch)
tree6299fd6681a589e4f7a58f8acd045e2579827d5c /numpy/distutils/tests/test_exec_command.py
parent19b96a1635ee93c487d69ab88ac5ea3a6a14e79e (diff)
downloadnumpy-b54108238dbd1ce2673a042b0b270f666ea96e29.tar.gz
STY: use `with open` when possible
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()"' %