summaryrefslogtreecommitdiff
path: root/setuptools/tests
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-01-16 17:32:19 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-01-16 17:32:19 -0500
commitd716b3c03b111512133126a5f42c7553bfb43174 (patch)
tree143d8d68df8960bfe225fcdece599327dd0bbd92 /setuptools/tests
parentefb37fc9c2e20f79f742e976e1bcd7fa2a27c5f0 (diff)
downloadpython-setuptools-git-d716b3c03b111512133126a5f42c7553bfb43174.tar.gz
Re-use tarfile_open for Python 2.6 compatibilty.
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_easy_install.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 77cf8da1..895ce7aa 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -364,7 +364,7 @@ class TestSetupRequires:
# extracted path to sys.path so foo.bar v0.1 is importable
foobar_1_dir = os.path.join(temp_dir, 'foo.bar-0.1')
os.mkdir(foobar_1_dir)
- with tarfile.open(foobar_1_archive) as tf:
+ with tarfile_open(foobar_1_archive) as tf:
tf.extractall(foobar_1_dir)
sys.path.insert(1, foobar_1_dir)
@@ -462,17 +462,13 @@ def make_sdist(dist_path, files):
listed in ``files`` as ``(filename, content)`` tuples.
"""
- dist = tarfile.open(dist_path, 'w:gz')
-
- try:
+ with tarfile_open(dist_path, 'w:gz') as dist:
for filename, content in files:
file_bytes = io.BytesIO(content.encode('utf-8'))
file_info = tarfile.TarInfo(name=filename)
file_info.size = len(file_bytes.getvalue())
file_info.mtime = int(time.time())
dist.addfile(file_info, fileobj=file_bytes)
- finally:
- dist.close()
def create_setup_requires_package(path, distname='foobar', version='0.1',