From dea4120fdc2cd90d9d68d3ffbc6e2118aadde125 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 7 Apr 2012 12:16:56 -0400 Subject: Improved the MockServer so it now more effectively handles multiple requests (as any index server really must). Test now more accurately captures the working scenario. --HG-- branch : distribute extra : rebase_source : 8ee0afdd95219047e4700b85356792f6128b1fd8 --- setuptools/tests/test_easy_install.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'setuptools/tests/test_easy_install.py') diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 54e3cdf9..87d24bb7 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -9,6 +9,7 @@ import site import contextlib import textwrap import tarfile +import urlparse from setuptools.command.easy_install import easy_install, get_script_args, main from setuptools.command.easy_install import PthDistributions @@ -269,13 +270,14 @@ class TestSetupRequires(unittest.TestCase): """ # set up a server which will simulate an alternate package index. p_index = setuptools.tests.server.MockServer() - p_index.handle_request_in_thread() + p_index.start() + p_index_loc = urlparse.urlparse(p_index.url).netloc # create an sdist that has a build-time dependency. with TestSetupRequires.create_sdist() as dist_file: with tempdir_context() as temp_install_dir: with environment_context(PYTHONPATH=temp_install_dir): ei_params = ['--index-url', p_index.url, - '--allow-hosts', 'localhost', + '--allow-hosts', p_index_loc, '--exclude-scripts', '--install-dir', temp_install_dir, dist_file] # attempt to install the dist. It should fail because @@ -283,8 +285,8 @@ class TestSetupRequires(unittest.TestCase): self.assertRaises(SystemExit, easy_install_pkg.main, ei_params) #self.assertTrue(os.listdir(temp_install_dir)) - self.assertEqual(len(p_index.requests), 1) - self.assertEqual(p_index.requests[0].path, 'x') + self.assertEqual(len(p_index.requests), 2) + self.assertEqual(p_index.requests[0].path, '/does-not-exist/') @staticmethod @contextlib.contextmanager -- cgit v1.2.3