diff options
author | Seth Troisi <sethtroisi@google.com> | 2020-01-21 11:32:58 -0800 |
---|---|---|
committer | Seth Troisi <sethtroisi@google.com> | 2020-01-21 11:34:58 -0800 |
commit | b54108238dbd1ce2673a042b0b270f666ea96e29 (patch) | |
tree | 6299fd6681a589e4f7a58f8acd045e2579827d5c /numpy/distutils/tests/test_exec_command.py | |
parent | 19b96a1635ee93c487d69ab88ac5ea3a6a14e79e (diff) | |
download | numpy-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.py | 5 |
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()"' % |