aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_easy_install.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-04-14 18:31:52 +0000
committerJason R. Coombs <jaraco@jaraco.com>2012-04-14 18:31:52 +0000
commit856ff28c515c35ad35db6661d0b74579f59c3e4c (patch)
treea934dcbffad4db6d081b1f7879dc25f7562883b4 /setuptools/tests/test_easy_install.py
parent55feac781e9f1286f32f617ba1f984faf82a08f0 (diff)
downloadexternal_python_setuptools-856ff28c515c35ad35db6661d0b74579f59c3e4c.tar.gz
external_python_setuptools-856ff28c515c35ad35db6661d0b74579f59c3e4c.tar.bz2
external_python_setuptools-856ff28c515c35ad35db6661d0b74579f59c3e4c.zip
Ensure that the setup.py is generated as bytes on Python 2 and 3 so that the tarfile module will accept it.
--HG-- branch : distribute extra : rebase_source : 07afe24875bff3a4892319e02ae66be0d3725c8e
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
-rw-r--r--setuptools/tests/test_easy_install.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 5577dd6a..cf2f91d6 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -313,14 +313,19 @@ class TestSetupRequires(unittest.TestCase):
"""
def build_sdist(dir):
setup_py = tarfile.TarInfo(name="setup.py")
- setup_py_bytes = StringIO.StringIO(textwrap.dedent("""
+ try:
+ # Python 3 (StringIO gets converted to io module)
+ MemFile = StringIO.BytesIO
+ except AttributeError:
+ MemFile = StringIO.StringIO
+ setup_py_bytes = MemFile(textwrap.dedent("""
import setuptools
setuptools.setup(
name="distribute-test-fetcher",
version="1.0",
setup_requires = ['does-not-exist'],
)
- """).lstrip())
+ """).lstrip().encode('utf-8'))
setup_py.size = len(setup_py_bytes.getvalue())
dist_path = os.path.join(dir, 'distribute-test-fetcher-1.0.tar.gz')
dist = tarfile.open(dist_path, 'w:gz')