From 3bcf6213d25381d9df9baa2b7a16c9449fbf78e7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 24 Nov 2015 18:55:48 -0500 Subject: Use context manager for opening file --- setuptools/tests/test_develop.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'setuptools') 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 -- cgit v1.2.3