diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-11-24 18:55:48 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-11-24 18:55:48 -0500 |
commit | 3bcf6213d25381d9df9baa2b7a16c9449fbf78e7 (patch) | |
tree | 1465374f8ee43cbdcd797b87c494f26bad138a8f /setuptools/tests/test_develop.py | |
parent | cf39578632c13d49866fe924bf4c5f5ba48db554 (diff) | |
download | external_python_setuptools-3bcf6213d25381d9df9baa2b7a16c9449fbf78e7.tar.gz external_python_setuptools-3bcf6213d25381d9df9baa2b7a16c9449fbf78e7.tar.bz2 external_python_setuptools-3bcf6213d25381d9df9baa2b7a16c9449fbf78e7.zip |
Use context manager for opening file
Diffstat (limited to 'setuptools/tests/test_develop.py')
-rw-r--r-- | setuptools/tests/test_develop.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index ed1b194a..b920655d 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -32,15 +32,13 @@ class TestDevelopTest: os.mkdir(os.path.join(self.dir, 'foo')) # setup.py setup = os.path.join(self.dir, 'setup.py') - f = open(setup, 'w') - f.write(SETUP_PY) - f.close() + with open(setup, 'w') as f: + f.write(SETUP_PY) self.old_cwd = os.getcwd() # foo/__init__.py init = os.path.join(self.dir, 'foo', '__init__.py') - f = open(init, 'w') - f.write(INIT_PY) - f.close() + with open(init, 'w') as f: + f.write(INIT_PY) os.chdir(self.dir) self.old_base = site.USER_BASE |