diff options
author | tarek <none@none> | 2009-10-27 09:44:07 +0100 |
---|---|---|
committer | tarek <none@none> | 2009-10-27 09:44:07 +0100 |
commit | 6ef67c96970c10cc7cb5d4c4093abc40817fa2ba (patch) | |
tree | 752132891e589e019e51cf0bf8dc69794f90e836 /setuptools/tests/test_easy_install.py | |
parent | 9d29ae853126d08c8779e7e158905ae263d6f52a (diff) | |
download | external_python_setuptools-6ef67c96970c10cc7cb5d4c4093abc40817fa2ba.tar.gz external_python_setuptools-6ef67c96970c10cc7cb5d4c4093abc40817fa2ba.tar.bz2 external_python_setuptools-6ef67c96970c10cc7cb5d4c4093abc40817fa2ba.zip |
Generated scripts now wraps their call in a __main__ section. Fixes #11
--HG--
branch : distribute
extra : rebase_source : d69b879d01ca2690826cdf9b7541e541ae8e0f5a
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
-rw-r--r-- | setuptools/tests/test_easy_install.py | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 583c072b..6ce20e42 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -1,9 +1,32 @@ """Easy install Tests """ +import sys import os, shutil, tempfile, unittest -from setuptools.command.easy_install import easy_install +from setuptools.command.easy_install import easy_install, get_script_args from setuptools.dist import Distribution +class FakeDist(object): + def get_entry_map(self, group): + if group != 'console_scripts': + return {} + return {'name': 'ep'} + + def as_requirement(self): + return 'spec' + +WANTED = """\ +#!%s +# EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' +__requires__ = 'spec' +import sys +from pkg_resources import load_entry_point + +if __name__ == '__main__': + sys.exit( + load_entry_point('spec', 'console_scripts', 'name')() + ) +""" % sys.executable + class TestEasyInstallTest(unittest.TestCase): def test_install_site_py(self): @@ -18,3 +41,14 @@ class TestEasyInstallTest(unittest.TestCase): finally: shutil.rmtree(cmd.install_dir) + def test_get_script_args(self): + dist = FakeDist() + + old_platform = sys.platform + try: + name, script = get_script_args(dist).next() + finally: + sys.platform = old_platform + + self.assertEquals(script, WANTED) + |