aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_test.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-02 12:08:30 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-02 12:08:30 -0500
commit6a5d120fa48b91f4e4cd78404f48daa8f97a2bc4 (patch)
tree8f5838587f7be4eea001077c2a5d4ebb47c3fed3 /setuptools/tests/test_test.py
parentf0eaf642ac52c02cc605ee1222bd143ef5f36623 (diff)
downloadexternal_python_setuptools-6a5d120fa48b91f4e4cd78404f48daa8f97a2bc4.tar.gz
external_python_setuptools-6a5d120fa48b91f4e4cd78404f48daa8f97a2bc4.tar.bz2
external_python_setuptools-6a5d120fa48b91f4e4cd78404f48daa8f97a2bc4.zip
Use context opener
Diffstat (limited to 'setuptools/tests/test_test.py')
-rw-r--r--setuptools/tests/test_test.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py
index 5d7b72ba..aec9ec98 100644
--- a/setuptools/tests/test_test.py
+++ b/setuptools/tests/test_test.py
@@ -61,27 +61,27 @@ class TestTestTest:
os.mkdir(os.path.join(self.dir, 'name'))
os.mkdir(os.path.join(self.dir, 'name', 'space'))
os.mkdir(os.path.join(self.dir, 'name', 'space', 'tests'))
+
# setup.py
setup = os.path.join(self.dir, 'setup.py')
- f = open(setup, 'wt')
- f.write(SETUP_PY)
- f.close()
+ with open(setup, 'wt') as f:
+ f.write(SETUP_PY)
self.old_cwd = os.getcwd()
+
# name/__init__.py
init = os.path.join(self.dir, 'name', '__init__.py')
- f = open(init, 'wb')
- f.write(NS_INIT)
- f.close()
+ with open(init, 'wb') as f:
+ f.write(NS_INIT)
+
# name/space/__init__.py
init = os.path.join(self.dir, 'name', 'space', '__init__.py')
- f = open(init, 'wt')
- f.write('#empty\n')
- f.close()
+ with open(init, 'wt') as f:
+ f.write('#empty\n')
+
# name/space/tests/__init__.py
init = os.path.join(self.dir, 'name', 'space', 'tests', '__init__.py')
- f = open(init, 'wt')
- f.write(TEST_PY)
- f.close()
+ with open(init, 'wt') as f:
+ f.write(TEST_PY)
os.chdir(self.dir)
self.old_base = site.USER_BASE