aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_develop.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/tests/test_develop.py')
-rw-r--r--setuptools/tests/test_develop.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index ecd2212d..0813959d 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -43,7 +43,7 @@ class TestDevelopTest(unittest.TestCase):
f = open(init, 'w')
f.write(INIT_PY)
f.close()
-
+
os.chdir(self.dir)
self.old_base = site.USER_BASE
site.USER_BASE = tempfile.mkdtemp()
@@ -53,7 +53,7 @@ class TestDevelopTest(unittest.TestCase):
def tearDown(self):
if sys.version < "2.6" or hasattr(sys, 'real_prefix'):
return
-
+
os.chdir(self.old_cwd)
shutil.rmtree(self.dir)
shutil.rmtree(site.USER_BASE)
@@ -89,8 +89,16 @@ class TestDevelopTest(unittest.TestCase):
self.assertEqual(content, ['easy-install.pth', 'foo.egg-link'])
# Check that we are using the right code.
- path = open(os.path.join(site.USER_SITE, 'foo.egg-link'), 'rt').read().split()[0].strip()
- init = open(os.path.join(path, 'foo', '__init__.py'), 'rt').read().strip()
+ f = open(os.path.join(site.USER_SITE, 'foo.egg-link'), 'rt')
+ try:
+ path = f.read().split()[0].strip()
+ finally:
+ f.close()
+ f = open(os.path.join(path, 'foo', '__init__.py'), 'rt')
+ try:
+ init = f.read().strip()
+ finally:
+ f.close()
if sys.version < "3":
self.assertEqual(init, 'print "foo"')
else:
@@ -112,4 +120,3 @@ class TestDevelopTest(unittest.TestCase):
pass
finally:
os.chdir(old_dir)
-