summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_easy_install.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
-rw-r--r--setuptools/tests/test_easy_install.py40
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)
+