summaryrefslogtreecommitdiff
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
commit28554a17fe5c11952ef936b2785bc12cac3a4402 (patch)
treee93f4cd77d0fd5f6fa0ffa69b2650ee0fcba1513
parent7ce4bd5e9345329b1b78c6f517dbe267c8710fc6 (diff)
downloadpython-setuptools-bitbucket-28554a17fe5c11952ef936b2785bc12cac3a4402.tar.gz
Re-use tarfile_open for Python 2.6 compatibilty.
-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',