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.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index f0adcb18..ec655462 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -3,6 +3,7 @@
import os
import site
import sys
+import io
import pytest
@@ -74,16 +75,12 @@ class TestDevelopTest:
assert content == ['easy-install.pth', 'foo.egg-link']
# Check that we are using the right code.
- egg_link_file = open(os.path.join(site.USER_SITE, 'foo.egg-link'), 'rt')
- try:
+ fn = os.path.join(site.USER_SITE, 'foo.egg-link')
+ with io.open(fn) as egg_link_file:
path = egg_link_file.read().split()[0].strip()
- finally:
- egg_link_file.close()
- init_file = open(os.path.join(path, 'foo', '__init__.py'), 'rt')
- try:
+ fn = os.path.join(path, 'foo', '__init__.py')
+ with io.open(fn) as init_file:
init = init_file.read().strip()
- finally:
- init_file.close()
if sys.version < "3":
assert init == 'print "foo"'
else: