diff options
| author | tarek <none@none> | 2009-12-02 16:47:26 +0100 |
|---|---|---|
| committer | tarek <none@none> | 2009-12-02 16:47:26 +0100 |
| commit | 67b9811dc7c6b59e5815e5b27620ef3e416488ac (patch) | |
| tree | 230676503521b0e822e8781a829140662a205694 /setuptools/tests/test_easy_install.py | |
| parent | 8159dbb1f94821a8ec481662a87914826fb8c7c4 (diff) | |
| download | python-setuptools-git-67b9811dc7c6b59e5815e5b27620ef3e416488ac.tar.gz | |
easy_install doesn't use a setup.cfg located in the working dir - fixes #99
--HG--
branch : distribute
extra : rebase_source : 0ddcfcf2eb8ef650c248a1d5d86fe1b95100df10
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 6ce20e42..95909ca7 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -2,7 +2,7 @@ """ import sys import os, shutil, tempfile, unittest -from setuptools.command.easy_install import easy_install, get_script_args +from setuptools.command.easy_install import easy_install, get_script_args, main from setuptools.dist import Distribution class FakeDist(object): @@ -27,6 +27,12 @@ if __name__ == '__main__': ) """ % sys.executable +SETUP_PY = """\ +from setuptools import setup + +setup(name='foo') +""" + class TestEasyInstallTest(unittest.TestCase): def test_install_site_py(self): @@ -52,3 +58,35 @@ class TestEasyInstallTest(unittest.TestCase): self.assertEquals(script, WANTED) + def test_no_setup_cfg(self): + # makes sure easy_install as a command (main) + # doesn't use a setup.cfg file that is located + # in the current working directory + dir = tempfile.mkdtemp() + setup_cfg = open(os.path.join(dir, 'setup.cfg'), 'w') + setup_cfg.write('[easy_install]\nfind_links = http://example.com') + setup_cfg.close() + setup_py = open(os.path.join(dir, 'setup.py'), 'w') + setup_py.write(SETUP_PY) + setup_py.close() + + from setuptools.dist import Distribution + + def _parse_command_line(self): + msg = 'Error: a local setup.cfg was used' + opts = self.command_options + if 'easy_install' in opts: + assert 'find_links' not in opts['easy_install'], msg + return self._old_parse_command_line + + Distribution._old_parse_command_line = Distribution.parse_command_line + Distribution.parse_command_line = _parse_command_line + + old_wd = os.getcwd() + try: + os.chdir(dir) + main([]) + finally: + os.chdir(old_wd) + shutil.rmtree(dir) + |
