summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_egg_info.py
diff options
context:
space:
mode:
author"W. Trevor King" <wking@tremily.us>2014-10-16 17:31:16 -0700
committer"W. Trevor King" <wking@tremily.us>2014-10-16 17:31:16 -0700
commit0c1303c12ba7e94eb0f6a7d961828d0ff08ff93a (patch)
tree4a6c657fce08a669ec905e99a7fa23f0aaf7ec6e /setuptools/tests/test_egg_info.py
parentb3203c3fd58476f0bead1436bf83ef05d3288d26 (diff)
downloadpython-setuptools-git-0c1303c12ba7e94eb0f6a7d961828d0ff08ff93a.tar.gz
tests.egg_info: Test absolute egg-base install
Make sure this copies the appropriate metadata into EGG-INFO. This test currently fails, but the next commit fixes setuptools so it will pass.
Diffstat (limited to 'setuptools/tests/test_egg_info.py')
-rw-r--r--setuptools/tests/test_egg_info.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 4c4f9456..9f813560 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -1,8 +1,10 @@
+import distutils.core
import os
import sys
import tempfile
import shutil
+import stat
import unittest
import pkg_resources
@@ -35,6 +37,20 @@ class TestEggInfo(unittest.TestCase):
entries_f.write(entries)
entries_f.close()
+ def _create_project(self):
+ with open('setup.py', 'w') as f:
+ f.write('from setuptools import setup\n')
+ f.write('\n')
+ f.write('setup(\n')
+ f.write(" name='foo',\n")
+ f.write(" py_modules=['hello'],\n")
+ f.write(" entry_points={'console_scripts': ['hi = hello.run']},\n")
+ f.write(' zip_safe=False,\n')
+ f.write(' )\n')
+ with open('hello.py', 'w') as f:
+ f.write('def run():\n')
+ f.write(" print('hello')\n")
+
@skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
def test_version_10_format(self):
"""
@@ -81,6 +97,48 @@ class TestEggInfo(unittest.TestCase):
self.assertEqual(rev, '89000')
+ def test_egg_base_installed_egg_info(self):
+ self._create_project()
+ temp_dir = tempfile.mkdtemp(prefix='setuptools-test.')
+ os.chmod(temp_dir, stat.S_IRWXU)
+ try:
+ paths = {}
+ for dirname in ['home', 'lib', 'scripts', 'data', 'egg-base']:
+ paths[dirname] = os.path.join(temp_dir, dirname)
+ os.mkdir(paths[dirname])
+ config = os.path.join(paths['home'], '.pydistutils.cfg')
+ with open(config, 'w') as f:
+ f.write('[egg_info]\n')
+ f.write('egg-base = %s\n' % paths['egg-base'])
+ environ = os.environ.copy()
+ environ['HOME'] = paths['home']
+ code, data = environment.run_setup_py(
+ cmd=[
+ 'install', '--home', paths['home'],
+ '--install-lib', paths['lib'],
+ '--install-scripts', paths['scripts'],
+ '--install-data', paths['data']],
+ pypath=':'.join([paths['lib'], self.old_cwd]),
+ data_stream=1,
+ env=environ)
+ if code:
+ raise AssertionError(data)
+ egg_info = None
+ for dirpath, dirnames, filenames in os.walk(paths['lib']):
+ if os.path.basename(dirpath) == 'EGG-INFO':
+ egg_info = sorted(filenames)
+ self.assertEqual(
+ egg_info,
+ ['PKG-INFO',
+ 'SOURCES.txt',
+ 'dependency_links.txt',
+ 'entry_points.txt',
+ 'not-zip-safe',
+ 'top_level.txt'])
+ finally:
+ shutil.rmtree(temp_dir)
+
+
DUMMY_SOURCE_TXT = """CHANGES.txt
CONTRIBUTORS.txt
HISTORY.txt